In the burgeoning landscape of African smart cities, education stands as a cornerstone for sustainable development and unlocking future potential. Accurate student performance prediction holds immense social importance, enabling early intervention, improved learning outcomes, and equitable access to quality education, aligning with sustainable development goals. Traditional models often falter in Africa due to imbalanced datasets and irrelevant features. This research leverages machine learning in Nigerian classrooms to predict underperforming students. Techniques like synthetic minority oversampling, edited nearest neighbors, and the Boruta algorithm for feature selection, alongside genetic algorithms for efficiency, enhance model performance. The ensemble models achieve AUCs of 90–99.7%, effectively separating low-performing and high-performing students. Implemented via Streamlit and Heroku, these models support real-time, data-driven decisions, enhancing early intervention, personalized learning, and informing policy and public service design. This ensures equitable education and a brighter future across Africa. By leveraging ML, this research empowers universities to support struggling students, optimize educational costs, and promote inclusive development, fostering data-driven decision-making and resource allocation optimization. Ultimately, this research paves the way for a future where data empowers education within African smart cities, unlocking the full potential of data-driven solutions and ensuring equitable educational opportunities across the continent.