In this study, in line with TIMSS 2019 data, 8th grade students' school engagement in the Turkish education system and various variables in the field of science and mathematics, which are thought to be related to school engagement, were examined with the Random Forest method, a method amongst data mining methods. This research focuses on student bullying, which includes psychological factors at school, such as whether students like or dislike their lessons, their confidence in science, their self-confidence, absenteeism, and the effects of teachers' teaching methods on SE. The sample of the study consisted of 3872 students in the science data set and 3802 students in the mathematics data set, which remained as a result of the lost data deletion and assignment processes from 4077 students who originally participated in the application. The open-source Python infrastructure was used in the analysis of the data. Orange 3.32 data mining program was employed for model setup. The model performance criteria MSE, RMSE, MAE and R2 values obtained as a result of the analysis. In both areas, the variables that contribute to the prediction of students' school engagement were ranked according to their importance levels, starting from the most important, also interpreted and discussed. It was observed that the performance criteria of the established model have values close to zero in the field of science (MSE: 2.775 RMSE: 1.666 MAE: 1.267) and mathematics (MSE: 2.240 RMSE: 1.497 MAE: 1.131). Variables explain school engagement at the rate of 69.6% in science and 75.7% in mathematics. The order of importance of the variables in both areas showed a great similarity. Student bullying was obtained as the most important variable. Prospective studies can also be planned towards collecting more in-depth data deploying qualitative data collection methods under a qualitative research model that also includes the opinions of self, peers, teachers and parents. For the education policies that the TES should produce toward increasing SE, it is weighty to reduce and prevent student bullying in schools with sustainable practices. Exclusively school administrations should focus on student bullying with the help of counselors, diagnose the problems and take measures in and out of school according to the types of bullying.