In this paper, based on sampling and analysis of a large number of soft and weak sandwich slope data, several factors that have a great influence on slope stability are established, and a predictive analysis model describing the stability of soft and weak sandwich slopes is established by using the now more advanced partial least squares method. Then, for the traditional partial least squares method that is not suitable for the non-linear stability coefficient of the weak sandwich to slope stability prediction, the recursive partial least squares method with forgetting factor is proposed for the weak sandwich to slope stability prediction analysis to solve the problem of stability prediction lag. Finally, based on elastic mechanics, elastic fracture mechanics and unsaturated soil mechanics, the structure of soft and weak interlayers on slopes and their stability strength are studied, and the performance of MATLAB-based partial least squares method for slope stability prediction analysis is verified by designing orthogonal experiments. The results show that the predicted values do not differ much from the results of finite element calculation, the absolute errors are all less than 0.15, and there are 5 absolute non-differences less than 0.1, accounting for 62.5% of the total number of predicted groups. The relative errors were less than 6%. This study shows that the partial least squares method can deal with the nonlinear mapping relationship between slope stability and influencing factors well and can make more accurate and objective prediction results on the stability of slopes.