One of the challenges in e-learning is the customization of the learning environment to avoid learners’ failures. This paper proposes a Stacked Generalization for Failure Prediction (SGFP) model to improve students’ results. The SGFP model mixes three ensemble learning classifiers, namely, Light Gradient Boosting Machine (LGBM), eXtreme Gradient Boosting machine (XGB), and Random Forest (RF), using a Multilayer Perceptron (MLP). In fact, the model relies on high-quality training and testing datasets that are collected automatically from the analytic reports of the Blackboard Learning Management System (i.e., analytic for learn (A4L) and full grade center (FGC) modules. The SGFP algorithm was validated using heterogeneous data reflecting students’ interactivity degrees, educational performance, and skills. The main output of SGFP is a classification of students into three performance-based classes (class A: above average, class B: average, class C: below average). To avoid failures, the SGFP model uses the Blackboard Adaptive Release tool to design three learning paths where students have to follow automatically according to the class they belong to. The SGFP model was compared to base classifiers (LGBM, XGB, and RF). The results show that the mean and median accuracies of SGFP are higher. Moreover, it correctly identified students’ classifications with a sensitivity average of 97.3% and a precision average of 97.2%. Furthermore, SGFP had the highest F1-score of 97.1%. In addition, the used meta-classifier MLP has more accuracy than other Artificial Neural Network (ANN) algorithms, with an average of 97.3%. Once learned, tested, and validated, SGFP was applied to students before the end of the first semester of the 2020-2021 academic year at the College of Computer Sciences at Umm al-Qura University. The findings showed a significant increase in student success rates (98.86%). The drop rate declines from 12% to 1.14% for students in class C, for whom more customized assessment steps and materials are provided. SGFP outcomes may be beneficial for higher educational institutions within fully online or blended learning schemas to reduce the failure rate and improve the performance of program curriculum outcomes, especially in pandemic situations.