Air pollution is a growing environmental and public health challenge, particularly in rapidly urbanising cities such as Dar es Salaam. Elevated concentrations of particulate matter (PM2.5 and PM10) contribute to climate change impacts, threaten ecosystem health, and increase the risk of respiratory and cardiovascular diseases. Despite these challenges, traditional air quality management in Dar es Salaam has relied on limited monitoring infrastructure and descriptive analyses, which are insufficient for predicting pollution episodes or informing proactive mitigation strategies. This study addresses this gap by developing an AI-enabled framework for predicting urban air quality using sensor-based data collected from 14 monitoring stations across the municipalities of Kinondoni, Ilala, Temeke, Ubungo, and Kigamboni between 2021 and 2022. Four supervised machine learning models, such as Linear Regression, Polynomial Regression, Decision Tree, and Random Forest, were implemented to predict PM2.5 and PM10 concentrations based on historical pollutant measurements. Model performance was evaluated using the coefficient of determination (R²), Root Mean Square Error (RMSE), and Mean Absolute Error (MAE). The results demonstrate that tree-based models significantly outperform regression-based approaches. Decision Tree and Random Forest achieved near-perfect predictive accuracy across stations (R² ≈ 0.999–1.000), with substantially lower RMSE (0.045–0.189) and MAE (0.001–0.015) values compared to Linear and Polynomial Regression models. Random Forest exhibited slightly greater stability and robustness across heterogeneous urban environments, making it the most suitable model for operational deployment. The findings highlight spatial variability in pollution levels, particularly in areas influenced by traffic congestion, industrial activities, and waste disposal sites. Overall, the study demonstrates that AI-driven predictive modelling using low-cost sensor data can enhance early warning systems, support evidence-based environmental policymaking, and strengthen climate-informed urban management strategies. By enabling proactive pollution control interventions, the proposed framework contributes to sustainable urban development and improved public health outcomes in Dar es Salaam.