While the 10-year survival rate for localized prostate cancer patients is very good (>98%), side effects of treatment may limit quality of life significantly. Erectile dysfunction (ED) is a common burden associated with increasing age as well as prostate cancer treatment. Although many studies have investigated the factors affecting erectile dysfunction (ED) after prostate cancer treatment, only limited studies have investigated whether ED can be predicted before the start of treatment. The advent of machine learning (ML) based prediction tools in oncology offers a promising approach to improve the accuracy of prediction and quality of care. Predicting ED may help aid shared decision-making by making the advantages and disadvantages of certain treatments clear, so that a tailored treatment for an individual patient can be chosen. This study aimed to predict ED at 1-year and 2-year post-diagnosis based on patient demographics, clinical data and patient-reported outcomes (PROMs) measured at diagnosis. We used a subset of the ProZIB dataset collected by the Netherlands Comprehensive Cancer Organization (Integraal Kankercentrum Nederland; IKNL) that contained information on 964 localized prostate cancer cases from 69 Dutch hospitals for model training and external validation. Two models were generated using a logistic regression algorithm coupled with Recursive Feature Elimination (RFE). The first predicted ED 1 year post-diagnosis and required 10 pre-treatment variables; the second predicted ED 2 years post-diagnosis with 9 pre-treatment variables. The validation AUCs were 0.84 and 0.81 for 1 year and 2 years post-diagnosis respectively. To immediately allow patients and clinicians to use these models in the clinical decision-making process, nomograms were generated. In conclusion, we successfully developed and validated two models that predicted ED in patients with localized prostate cancer. These models will allow physicians and patients alike to make informed evidence-based decisions about the most suitable treatment with quality of life in mind.Copyright: © 2023 Hasannejadasl et al. This is an open access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.