Due to the widespread outbreak of Covid-19, many of the world's top universities have decided to hold the next semester virtually. In our country, too, the forecasts show a red situation for some areas in terms of corona prevalence. Due to the large number of students living in these areas, planning for the next semester of universities should be more focused on e-education. According to the instructions of the Ministry of Science, Research and Technology of Iran, the next semester should be implemented in two ways, including e-learning and face-to-face education. In face-to-face education with the requirements of the educational space and classrooms, students are divided into two sub-disciplines A and B. The students in each category will be present in the class in different weeks so that it is possible to implement health protocols in the educational space and classrooms. In this paper, to determine the number of students and classes for both sub-disciplines A and B in face-to-face education, a MATHEMATICAL optimization MODEL in the form of nonlinear programming with integer variables is proposed. In the objective function of the MODEL, the distribution of students in the educational space and classrooms is considered in such a way that the maximum possible dispersion is possible to prevent the spread of coronary heart disease. In this MODEL, class capacity constraints as well as constraints for holding classes on even days (Saturday, Monday), odd days (Sunday and Tuesday) and Wednesday are considered. This MODEL has been implemented for allocating classes in the Faculty of Statistics, Mathematics and Computer of Allameh Tabataba’ i University and its use has brought satisfactory results for decision makers.