The risk problems of listed companies will not only bring great losses to the enterprise, how to find out the risk information from the many data of the enterprise and take risk prevention in advance is crucial for the healthy development of the enterprise. Combining relevant research results with network crawling technology to obtain research data, and pre-processing the disturbing information in the data. After setting the enterprise financial risk prediction index system and model evaluation indexes, the KPCA algorithm is used to downsize the prediction index system, followed by the construction of the enterprise financial risk prediction model based on the XGBoost algorithm, and the application of the model is analyzed. The prediction accuracy of this paper’s model for ST enterprise financial risk in 2022 is more than 0.9, indicating that the prediction model constructed in this paper has excellent application value and promotes the development of intelligent detection of enterprise financial risk.