Concrete is the most widely used material in the building industry due to its affordability, durability, and strength. However, considering carbon emissions, it is believed that concrete will be replaced by geopolymers in the future. As numerous parameters significantly affect the strength of geopolymers, the performance of potential algorithms for strength prediction needs to be evaluated for different binders to select an appropriate algorithm. This study employs machine learning approaches to provide the best prediction method for the flexural strength and compressive strength of geopolymers. A new dataset containing 533 compressive strength and 533 flexural strength values of geopolymers with different binders such as waste glass (GW), obsidian (OB), and fly ash was created. The best prediction solution, with R2 = 0.981 for compressive strength and R2 = 0.898 for flexural strength, was obtained from the extreme gradient boosting (XGBoost) algorithm. Additionally, several other machine learning models were employed, including linear regression, k-nearest neighbors, deep neural network, and random forest, with corresponding determination coefficient (R2) values of 0.763, 0.804, 0.93, and 0.96, respectively. These models were trained and evaluated using a dataset encompassing features such as binder types, age, and heat, to forecast the mechanical properties of geopolymers. Among these models, XGBoost demonstrated the highest R2 value, indicating superior performance in predicting both compressive and flexural strengths. The findings of this study provide valuable insights into the selection of appropriate machine learning algorithms for predicting mechanical properties in geopolymers, thus contributing to advancements in sustainable construction materials.