As the demand for sustainable construction materials grows, one-part geopolymers present a viable alternative due to their potential for enhancing strength while minimizing carbon emissions and costs. However, accurately predicting the compressive strength of these materials poses significant challenges. Traditional predictive methods, including empirical equations and basic regression techniques, often fall short in capturing the complex relationships among compositional variables. This study employs machine learning (ML) techniques to improve the prediction of compressive strength and perform sensitivity analysis for one-part geopolymers. Experimental analyses were conducted to assess compressive strength, microstructure, and pore characteristics, revealing that increased slag replacement rates enhance hardness and porosity, particularly at levels below 60 %. Given the inherent uncertainties in modeling one-part geopolymer strength, six ML models were evaluated using a comprehensive database. The XGB model exhibited excellent performance, achieving an R2 of 0.95 and an RMSE of 5.2 on the test set, with results validated through experimental data. Additionally, feature importance analysis utilizing the SHAP method highlighted slag percentage, activator Na2O content, and water-cement ratio as critical factors influencing strength. This research provides an effective and interpretable framework for optimizing one-part geopolymer formulations, advancing sustainable practices in construction.