There is A LOT of confusion about visa situation for type training between students, training providers AND STATE OFFICIALS. Especially state officials - for example, I have two absolutely contradictory letters from different governmental officials regarding this. And if CBP officer has a different opinion than you were told in US consulate, training facility etc, you are not allowed into the country and there is no one to complain to...
There is ONLY one way to be 100% legal in this situation - to have student visa (in most cases, M1).
There is a very big possibility your training provider is NOT registered with SEVIS and can't provide I-20 form required for M1 visa. What to do ? No one knows...