I'm an Indian national working towards a Master's degree in the US (F1 visa). I may apply for an H1B visa later. Would visiting countries which are on not on so great a terms with the US affect such an application? Case in point - North Korea.
Yes, of course it will affect your application. With any luck, however, the effect will be minimal.
The officer examining your application will want to know why you visited the country in question, and the reason for the visit may cause them to look in more detail into whether to approve the application.
If your visit was legitimate, however, you shouldn't have anything to worry about. Just answer any questions truthfully. Having been in North Korea will not be an automatic problem, but being discovered in a lie will result in automatic refusal of your visa.