To better prevent the occurrence of hidden dangers of coal mine accidents and ensure the safety production of coal mine enterprises. This paper mines and analyses the pattern of historical monthly hidden danger quantity in the coal mine and constructs three models: the traditional backpropagation (BP) neural network model, the BP neural network based on the adaptive moment estimation optimization algorithm (Adam-BP) model, and the BP neural network prediction model with the introduction of monthly moderators (Month-Adam-BP). The experimental results show that the Adam-BP model can improve the prediction accuracy, in which the mean absolute percentage error (MAPE) improves by 8.93%, the root mean square error (RMSE) improves by 8.15%, the postdifference ratio C improves by 0.04, and the small error probability P improves by 0.12; the Month-Adam-BP model with the introduction of the monthly adjustment factor further improves the prediction accuracy, in which MAPE improves by 2.61%, RMSE improves by 5.41%, the postdifference ratio C improves by 0.06, and the small error probability P improves by 0.03. And the Month-Adam-BP model prediction accuracy reaches the level 2 standard with credible prediction effect; it can also be used to predict coal mines with periodic characteristics of hidden hazard data. Our prediction results show that the predicted number of hidden hazards in this coal mine for the next month is 29, which is an increase compared to the number of hidden dangers in the previous month. Thus, the coal mine safety managers need to strengthen the management of hidden hazards further to prevent accidents, which can better serve the standardization of coal mine safety production and ensure the smooth production of the coal mine.