With the impact of human engineering activities, groundwater pollution has seriously threatened the health of human life. Accurate water quality assessment is the basis of controlling groundwater pollution and improving groundwater management, especially in specific regions. A typical semi-arid city in Fuxin Province of China is taken as an example. We use remote sensing and GIS to compile four environmental factors, such as rainfall, temperature, LULC, and NDVI, to analyze and screen the correlation of indicators. The differences among the four algorithms were compared by using hyperparameters and model interpretability, including random forest (RF), support vector machine support vector machine (SVM), decision tree (DT), and K-nearest neighbor (KNN). The groundwater quality of the city during the dry and wet periods was comprehensively evaluated. The results show that the RF model has higher integrated precision (MSE = 0.11, 0.035; RMSE = 0.19,0.188; R-2 = 0.829,0.811; ROC = 0.98, 0.98). The quality of shallow groundwater is poor in general, 29%, 38%, 33% of the groundwater quality in low-water period is III, IV, V water. Thirty-three percent and 67% of the groundwater quality in the high-water period were IV and V water. The proportion of poor water quality in high-water period was higher than that in low-water period, which was consistent with the actual investigation. This study provides a kind of machine learning method for the semi-arid area, which cannot only promote the sustainable development of groundwater in this area, but also provide reference for the management policy of related departments.