Traditional credit risk assessment mainly relies on expert experience and simple statistical models, which are difficult to effectively deal with complex nonlinear relationships in massive multidimensional data. The unbalanced dataset problem makes the model insufficiently capable of recognizing a few types of defaulting customers, resulting in limited risk control effects. Aiming at the risk prediction problem in financial credit asset management, this study constructs a credit risk prediction model based on extreme gradient boosting (XGBoost). The customer data of a financial institution for the observation period of 2023 and the performance period of 2024 are used, with a total of 124,980 samples, of which 13,000 are positive samples, accounting for 10.40%, and containing 51 variable features. The study adjusts the model parameters by hyperopt Bayesian optimization method, setting learning-rate to 0.06, gamma to 0.04, n-estimator to 4, and subsample to 0.8. An improved unbalanced data processing strategy is used in conjunction with XGBoost algorithm, which optimizes the second-order gradient information and regularization term using the objective function. The experimental results show that the AUC value of this paper’s method reaches 0.8463, which is significantly better than the 0.8324 of the traditional SMOTE oversampling method and the 0.8401 of the simple undersampling method.In the comparison with other machine learning algorithms, the AUC value of XGBoost combined with EasyEnsemble sampling is 0.8472, which outperforms the 0.8159 of the decision tree and the 0.8004 of the support vector machine’s 0.8004.The study verifies the effectiveness of the extreme gradient boosting algorithm in dealing with unbalanced financial data, and provides reliable technical support for credit risk management of financial institutions.