Learning analytics has become an essential component of evidence-based decision-making in higher education, yet many predictive models continue to face critical limitations, including weak generalizability, narrow contextual alignment, and limited integration of established student retention theories. This study advances the field by developing a theoretically grounded and ensemble learning model to predict student retention at the International University of Management (IUM) in Namibia. Using a large-scale dataset of 11,090 anonymised student records (2021–2023) comprising academic, behavioural, demographic, and engagement variables, the study applies a suite of machine learning techniques including Decision Tree, Random Forest, Support Vector Machine, Artificial Neural Network, and Gradient Boosting and an optimized stacking ensemble architecture. The dataset was divided into 80% training and 20% testing subsets, and the models were evaluated using 10-fold cross-validation to ensure stability and generalizability. Predictive performance was assessed using accuracy, precision, recall, and F1-score, with the final ensemble (DT-ANN-RF-SVM) achieving 94.6% accuracy, outperforming all individual models. The study makes three key contributions: (1) it operationalizes constructs from Tinto’s Student Integration Theory, Bean and Metzner’s Attrition Model, and Astin’s Theory of Student Involvement into measurable learning analytics variables; (2) it demonstrates how ensemble learning can overcome methodological limitations prevalent in prior work; and (3) it offers a reproducible institutional framework for applying analytics-driven retention strategies. The results highlight the value of theoretically informed machine learning models in identifying at-risk students early and enabling tailored support interventions. The findings provide actionable insights for institutional policy, pedagogical design, and future research on adaptive learning analytics in higher education.