Groundwater resources, unlike surface water, are more vulnerable to disturbances and contaminations, as they take a very long time and significant cost to recover. So, predictive modeling and prevention strategies can empower policymakers for efficient groundwater governance through informed decisions and recommendations. Due to the importance of groundwater quality modeling, the hardness susceptibility mapping using machine learning (ML) models has not been explored. For the first time, the current research aimed to predict groundwater hardness susceptibility using the ML models. The performance of two ensemble models of boosted regression trees (BRT) and random forest (RF) is investigated through the arrangement of a comparative study with multivariate discriminant analysis (MDA). According to the hardness values in 135 groundwater quality monitoring wells, the hard and soft water are determined; then, 11 predictor variables including distance from the sea (DFS), land use, elevation, distance from the river (DFR), depth to groundwater (DTGW), pH, precipitation (PCP), evaporation (E), groundwater level (GWL), curvature, and lithology are used for predicting the groundwater hardness susceptibility map. Results indicated that the variables of DFR, DTGW, elevation, and DFS had a higher contribution to the modeling process. So, the high harness areas are mostly related to low elevations, low DTGW, and proximity to river and sea, which facilitate the percolation conditions for minerals containing calcium or magnesium into groundwater.