To analyze the factors affecting road accidents involving hazardous materials, the Bayesian network (BN) model was used to fit the accident data. However, considering the possible overfitting phenomenon of the BN model, the model was optimised by combining Pearson’s chi-squared test and Granger causality test (PG) methods. First, the data of hazardous materials accidents were preprocessed, and the index system of factors affecting hazardous materials road transport was constructed from five dimensions of “people, vehicles, hazmat, roads, and environment”; second, Pearson’s chi-squared test and the Granger causality test were used to screen the factors affecting hazardous materials road transport accidents and to determine the causal relationship between the factors; finally, the BN model was constructed with accident severity and accident processing time as target nodes, and the results were analyzed and validated. The results show that the overall relative error rate of the model is less than 10% and can be used to explore the risk factors of hazardous materials transport accidents; weather, visibility, lighting, intersection type, road condition, road type, driver condition, vehicle type, etc. are all important factors affecting the severity of hazardous materials transport accidents. The study can serve as a reference for the safety supervision and management of hazardous materials transport enterprises and industrial management departments.