Mining in Huanglong Coalfield faces the threat of water damage on the roof of the giant thick Luohe Group sandstone, and accurate prediction of the water-rich capacity of the aquifer is the basis of mine water control. For how to predict the water-rich capacity of aquifer in Dafosi Coal Mine, by collecting 33 groups of hydrological borehole pumping test data from Dafosi and neighboring mines, the equivalent thickness of aquifer, flushing fluid consumption, ratio of sandstone to strata thickness, depth of aquifer, and take rate of core were selected as the evaluation indexes ofwater-rich capacity of the drilling holes, and the prediction model of optimized limiting gradient boosting tree by Sparrow Search Algorithm (SSA) (XGBoost) prediction model, iteratively learning the nonlinear mapping relationship between water-rich capacity and each index by SSA-XGBoost model, predicting the water-rich capacity of Luohe Formation in the remaining non-hydrological holes, and zoning according to the results. The results show that the SSA-XGBoost model can accurately predict the water-richness of the Luohe Formation, and the water-richness capacity of the roof aquifer of the coal seam in Dafosi Coal Mine is medium, with a high degree of threat from water damage.