Abstract
The rapid expansion of distance-learning programs in Science, Technology, Engineering, and Mathematics (STEM) has democratized access to higher education, yet it is accompanied by high student attrition rates. Early identification of academic struggle is critical to deploying timely, targeted interventions. This study proposes and evaluates a Random Forest machine learning model designed to identify at-risk students within the first four weeks of a semester. Utilizing learning analytics data from a cohort of 1,248 undergraduate students enrolled in online STEM courses, we engineered features from Learning Management System (LMS) interaction logs, demographic records, and early formative assessment scores. By week four, the optimized Random Forest classifier achieved an overall predictive accuracy of 86.4% and an Area Under the Receiver Operating Characteristic (AUC-ROC) curve of 0.892, significantly outperforming baseline logistic regression and decision tree models. Feature importance analysis revealed that the frequency of accessing interactive simulation modules, the timeliness of quiz submissions, and active engagement in discussion forums were the strongest predictors of student success. These findings demonstrate that early-semester digital footprints can reliably forecast student outcomes, providing educators with an actionable diagnostic tool to foster student retention and support diverse learners in virtual STEM environments.