As soon as you have officially been admitted at the university, and have received the I-20 form, you should apply for a visa at the nearest US embassy. The delay before getting an appointment can be long, and you should plan at least a month between your admission and the appointment at the embassy.