Vanadium dioxide (VO2) is a promising material for energy-saving smart windows due to its reversible metal-to-insulator transition near room temperature, concomitantly with a structural phase transition between monoclinic VO2(M) phase and rutile VO2(R) phase. However, the fact that VO2 has a complex crystalline phase makes its reliable synthesis an obstacle to its practical application. Machine learning (ML), a specific subset of artificial intelligence, can be utilized to generate virtual representations of experimental conditions and outcomes for the purpose of predicting experiments. Therefore, in the paper, four machine learning models were trained to perform optimization of the VO2 hydrothermal synthesis. A random forest model achieved a classification accuracy of 87.27%. The synthetic parameter space was explored to filter combinations with a synthetic probability above 90%. Random forest models were used to guide the experimental synthesis, and the obtained products were characterized using X-ray diffraction, scanning electron microscopy, X-ray photoelectron spectroscopy, and differential scanning calorimetry. The results showed that phase-pure VO2(B) and VO2(M) were successfully synthesized, demonstrating the effectiveness of machine learning in optimizing material synthesis, alleviating the stochasticity of material synthesis caused by the control of synthesis conditions, and promoting the application research of VO2 materials.