Myelofibrosis (MF) is a myeloproliferative neoplasm (MPN) with heterogeneous clinical course. Allogeneic hematopoietic cell transplantation remains the only curative therapy, but its morbidity and mortality require careful candidate selection. Therefore, accurate disease risk prognostication is critical for treatment decision-making. We obtained registry data from patients diagnosed with MF in 60 Spanish institutions (N = 1386). These were randomly divided into a training set (80%) and a test set (20%). A machine learning (ML) technique (random forest) was used to model overall survival (OS) and leukemia-free survival (LFS) in the training set, and the results were validated in the test set. We derived the AIPSS-MF (Artificial Intelligence Prognostic Scoring System for Myelofibrosis) model, which was based on 8 clinical variables at diagnosis and achieved high accuracy in predicting OS (training set c-index, 0.750; test set c-index, 0.744) and LFS (training set c-index, 0.697; test set c-index, 0.703). No improvement was obtained with the inclusion of MPN driver mutations in the model. We were unable to adequately assess the potential benefit of including adverse cytogenetics or high-risk mutations due to the lack of these data in many patients. AIPSS-MF was superior to the IPSS regardless of MF subtype and age range and outperformed the MYSEC-PM in patients with secondary MF. In conclusion, we have developed a prediction model based exclusively on clinical variables that provides individualized prognostic estimates in patients with primary and secondary MF. The use of AIPSS-MF in combination with predictive models that incorporate genetic information may improve disease risk stratification.