Education is important for societal advancement and individual empowerment, providing opportunities, developing essential skills, and breaking cycles of poverty. Nonetheless, the path to educational success is marred by challenges such as achieving academic excellence and preventing student dropouts. Early identification of students at risk of dropping out or those likely to excel academically can significantly enhance educational outcomes through tailored interventions. Traditional methods often fall short in precision and foresight for effective early detection. While previous studies have utilized machine learning to predict student performance, the potential for more sophisticated ensemble methods, such as stacked classifiers, remains largely untapped in educational contexts. This study develops a stacked classifier integrating the predictive strengths of LightGBM, Random Forest, and logistic regression. The model achieved an accuracy of 80.23%, with precision, recall, and F1-score of 79.09%, 80.23%, and 79.20%, respectively, surpassing the performance of the individual models tested. These results underscore the stacked classifier's enhanced predictive capability and transformative potential in educational settings. By accurately identifying students at risk and those likely to achieve academic excellence early, educational institutions can better allocate resources and design targeted interventions. This approach optimizes educational outcomes and supports informed policymaking, fostering environments conducive to student success.