A novel optimization design method for loading paths was proposed, which not only converted complex path optimization into the optimization of discrete point coordinates to reduce the difficulty of solving, but also integrated machine learning to enhance efficiency and solution accuracy. For the multi-stage hydroforming of ultrathin M-shaped component, the analytical models for key process parameters were derived based on static mechanical analysis. Through analysis of the process parameter boundary constraints, a process window was constructed, revealing a positive correlation between the maximum fracture pressure and the strain ratio. A loading path with three characteristic points was designed for forming the M-shaped ring. Pre-bulging pressure and deformation distance were found to have significant effects on wall thickness and edge movement, while the design space for pre-bulging pressure, deformation distance and feeding bulging pressure was established. Simulation results from uniform design experiments served as training samples to develop a machine learning model that elucidates the relationship between process parameters and forming quality. Using a genetic algorithm, the optimal loading path was determined and subsequently validated through experiments. The experimental results demonstrated that the formed M-shaped parts using the designed optimal loading path exhibited excellent forming quality. The cross-sectional shape accuracy of the formed component aligned well with the theoretical values. Furthermore, the maximum thickness thinning rate of the part was only 6.66%, further validating the effectiveness of the proposed optimal loading path design method for process parameters design in multi-stage forming processes.