Financial risk has a greater impact on the operation and development of enterprises, and accurate prediction of financial risk has become an industry demand, so as to better help enterprises avoid possible financial risk. The article establishes an enterprise financial risk prediction model based on the random forest algorithm, and fills in the oversampling of financial data through the SMOTENC algorithm, and realizes the downsizing of financial data by combining with the KPCA algorithm. Based on the enterprise financial risk characterization index system, the financial data of 358 listed enterprises were selected to carry out model validation and application analysis. The accuracy of corporate financial risk prediction based on Random Forest can reach up to 94.17%, and the average value of the overall time efficiency of the model is 0.68%, which is faster than the comparison algorithm in terms of financial data processing capability. Based on the results of financial risk prediction, the changes in corporate profitability, operating ability, solvency and development ability can be analyzed in depth, providing data support for enterprises to formulate preventive measures for corporate financial risk.