Aiming at the problems of insufficiently comprehensive prediction content and scope as well as the methods of prediction to be improved in the current research on chemical process safety risk prediction, this paper is based on Bayesian network (BN) for real-time assessment and early warning of chemical process safety risk of ammonia synthesis. The constructed risk warning model CNN-ATT-LSTM-BN is divided into two parts: one is the CNN-ATT-LSTM prediction model that combines CNN, LSTM, and attention mechanism, and the other is the safety risk traceability model based on BN. It is shown that the optimal values of linear regression correlation coefficient R2 and root mean square error RMSE of the CNN-ATT-LSTM model are 0.98794 and 0.00088, respectively, which have very high accuracy and are better than the other compared models. Meanwhile, the chemical process risk early warning was realized by risk assessment of the prediction results and risk change curves were obtained. The risk traceability results show that the probability that a safety problem may eventually occur in the chemical production stage is 15.04%, in which the human risk factors (85.74%), followed by mechanical and process factors (22.35%), have the greatest impact on safety. In addition, this paper proposes a scheme to realize risk early warning decision-making by using knowledge mapping, which can be used as a reference for subsequent risk prevention and treatment and other work.