H3 K27M-mutant diffuse midline glioma (H3 K27M-mt DMG) is a rare, highly invasive tumor with a poor prognosis. The prognostic factors of H3 K27M-mt DMG have not been fully identified, and there is no clinical prediction model for it. This study aimed to develop and validate a prognostic model for predicting the probability of survival in patients with H3 K27M-mt DMG. Patients diagnosed with H3 K27M-mt DMG in the West China Hospital from January 2016 to August 2021 were included. Cox proportional hazard regression was used for survival assessment, with adjustment for known prognostic factors. The final model was established using the patient data of our center as the training cohort and data from other centers for external independent verification. One hundred and five patients were ultimately included in the training cohort, and 43 cases from another institution were used as the validation cohort. The factors influencing survival probability in the prediction model included age, preoperative KPS score, radiotherapy and Ki-67 expression level. The adjusted consistency indices of the Cox regression model in internal bootstrap validation at 6, 12, and 18 months were 0.776, 0.766, and 0.764, respectively. The calibration chart showed high consistency between the predicted and observed results. The discrimination in external verification was 0.785, and the calibration curve showed good calibration ability. We identified the risk factors that affect the prognosis of H3 K27M-mt DMG patients and then established and validated a diagnostic model for predicting the survival probability of these patients.