The difficulty in determining the bearing capacity of pile foundations in saline soil environments in cold regions can pose a challenge when developing a bearing capacity prediction model. To address this, the study uses data from the construction of the De Xiang Expressway project in Qinghai Province, China, and considers pile length, pile diameter, corrosion depth, and spalling thickness as influential parameters. We combine Python with ABAQUS to build a finite element model of a single pile in a salt marsh environment with random parameters and develop a database for machine learning. We use the kernel ridge regression (KRR) and multilayer perceptron (MLP) algorithms to establish load-bearing capacity prediction models for vertical and horizontal loads, respectively. The SHAP (SHapley Additive exPlanations) method is employed to perform explanatory analysis on the prediction models, providing insight into influential parameter effects on prediction accuracy. The results demonstrate that the database established through the random parameter finite element method is suitable for machine learning. While the KRR model exhibits good performance in predicting vertical load-bearing capacity, the MLP model performs well in predicting horizontal load-bearing capacity. Moreover, the SHAP method effectively explains the importance of influential parameters on the prediction results and enhances the reliability of the prediction models. The vertical bearing capacity of a saline soil pile foundation is more affected by the depth of salt erosion than the thickness of spalling, while the horizontal bearing capacity is more affected by the thickness of spalling than the depth of salt erosion.