The Xiashu loess exhibits expansion when in contact with water and contraction when water is lost, making it highly susceptible to the influence of rainfall. Therefore, it is essential to investigate the infiltration behavior of rainwater in Xiashu loess slopes under various conditions. The depth of infiltration in slopes directly affects the depth of landslide failure and serves as an important indicator for studying slope infiltration characteristics; only a handful of academics have delved into its study. This article is based on on-site rainfall experiments on Xiashu loess slopes, using three main factors, rainfall intensity, rainfall duration, and slope angle, as discrimination indicators for the infiltration depth of Xiashu loess slopes. The particle swarm optimization algorithm is employed to optimize the BP neural network and establish a PSO-BP neural network prediction model. The experimental data are accurately predicted and compared with the multivariate nonlinear regression model and traditional BP neural network models. The results demonstrate that the PSO-BP neural network model exhibits a better fit and higher prediction accuracy than the other two models. This model provides a novel approach for rapidly determining the infiltration depth of Xiashu loess slopes under different rainfall conditions. The results of this study lay the foundation for the prediction of the landslide damage depth and infiltration of Xiashu loess slopes.