Urban municipal water supply is an important part of underground pipelines, and their scale continues to expand. Due to the continuous improvement in the quality and quantity of data available for pipeline systems in recent years, traditional pipeline network risk assessment cannot cope with the improvement of various monitoring methods. Therefore, this paper proposes a machine learning-based risk assessment method for municipal pipe network operation and maintenance and builds a model example based on the data of a pipeline network base in a park in Suzhou. We optimized the random forest learning model, compared it with other centralized learning methods, and finally evaluated the model’s learning effect. Finally, the risk probability associated with each pipe segment sample was obtained, the risk factors affecting the pipe segment’s failure were determined, and their relevance and importance ranking was established. The results showed that the most influential factors are pipe material, soil properties, service life, and the number of past failures. The random forest algorithm demonstrated better prediction accuracy and robustness on the dataset.