training
The regulations specifically address training for a certificate or rating. You can fly while you are in the US, but you would need to have either an M1 or F1 to apply for the rating.
We recently went over this with SEVIS and ICE for a similar situation.