The landslide incidence around petroleum pipelines usually leads to severe pipeline damage, causing serious environmental pollution, economic losses, and even casualties. The commonly used methods for monitoring petroleum pipelines include remote sensing and ground monitoring, which can be further applied in predicting landslide hazards. However, current landslide prediction strategies are generally limited because the provided predictive indicators are restricted, and the prediction needs to be more timely. These limitations have caused significant difficulties in the practical application of landslide prediction. Based on the actual operating conditions and landslide incidence records of a section of the pipeline, we propose a machine learning-based landslide prewarning system for buried pipelines to achieve real-time landslide monitoring and rapid warning. Landslide conditions and pipeline operation records are collected using a ground monitoring system around the target pipeline section. They are integrated to generate machine learning datasets extended using the finite element method (FEM). After comparing multiple machine learning algorithms, the XGBoost model is ultimately adopted for the prediction system. The system is calibrated and verified by comparing the prediction results with landslide data. In the verification test, the landslide warning message is acquired about 10 h before the landslide occurrence, and the error in predicting the position of the landslide is about 20 m in the case of the 466 m target pipeline.