In recent years, due to the instability of the slope caused by countless accidents, to human production, life has brought immeasurable costs. Therefore, it is of great significance to understand the slope correctly, analyze and design it reasonably, and take appropriate protective measures to minimize the loss and harm caused by instability. In order to determine whether the slope is stable or not more quickly and efficiently, a slope safety and stability evaluation system is established based on machine learning, integrating principal component analysis (PCA), parameter adjustment, influence factor weight analysis, etc. It is found that PCA can reduce the dimension of input variables from six to three dimensions while retaining 80% of the information, but the effect of the model decreases. Both the random forest and XGBoost learning algorithms can build effective evaluation models for slope safety and stability. Through the comparative analysis of their prediction effects, XGBoost is determined to be the best evaluation model. At the same time, this article take the chi-square test, F test correlation and mutual information method, three kinds of test means, and the importance of the evaluation factors by calculation and visualization display, has been clear about the unit weight, high slope, Angle of internal friction and cohesion the importance of the four internal factors, finally will assess the results combined with actual slope safety protection measures are put forward.