Does a moroccan national need a visa to transit through US?

You will need a visa in order to come to the US, whether a tourist visa, work visa, or student visa. Once you are admitted into the country, you can generally go directly to your destination. Of course, if getting somewhere in the US requires flying, you will have to produce your passport each time you are at an airport.