In recent years, groundwater discharge is more than recharge, resulting in a drop-down in groundwater levels. Rangeland and forest are considered the main recharge areas of groundwater, while the most uses of these resources are done in agricultural areas. The main goal of this research is to use machine learning algorithms including random forest and Shannon's entropy function to model groundwater resources in a semi-arid rangeland in western Iran. Therefore, the layers of slope degree, slope aspect, elevation, distance from the fault, the shape of the slope, distance from the waterway, distance from the road, rainfall, lithology, and land use were prepared. After determining the weight of the parameters using Shannon's entropy function and then determining their classes, the final map of the areas with the potential of groundwater resources was modeled from the combination of the weight of the parameters and their classes. In addition, R 3.5.1 software and the randomForest package were used to run the random forest (RF) model. In this research, k-fold cross-validation was used to validate the models. Moreover, the statistical indices of MAE, RMSE, and R2 were used to evaluate the efficiency of the RF model and Shannon's entropy for finding the potential of underground water resources. The results showed that the RF model with accuracy (RMSE: 3.41, MAE: 2.85, R² = 0.825) has higher accuracy than Shannon's entropy model with accuracy (R² = 0.727, RMSE: 4.36, MAE: 3.34). The findings of the random forest model showed that most of the studied area has medium potential (26954.2 ha) and a very small area (205.61 ha) has no groundwater potential. On the other hand, the results of Shannon's entropy model showed that most of the studied area has medium potential (24633.05 ha) and a very small area (1502.1 ha) has no groundwater potential.