To create an HTML code for a Facebook comment box, one must first login to their Facebook account and register an app on the Facebook developer dashboard. They then customize and generate the code for a comment box social plugin specific to their registered domain. Finally, they copy the generated code and paste it into their website HTML to display the comment box.