Objective: To develop and validate an algorithm for predicting non-attendance to outpatient appointments. Results: We developed two decision tree models for dermatology and pneumology services (trained with 33,329 and 21,050 appointments, respectively). The prospective validation showed a specificity of 78.34% (95%CI 71.07, 84.51) and a balanced accuracy of 70.45% for dermatology; and 69.83% (95%CI 60.61, 78.00) - 65.53% for pneumology, respectively. When using the algorithm for identifying patients at high risk of non-attendance in the context of a phone-call reminder program, the non-attendance rate decreased 50.61% (P<.001) and 39.33% (P=.048) in the dermatology and pneumology services, respectively. Conclusions: A machine learning model can effectively identify patients at high risk of non-attendance based on information stored in electronic medical records. The use of this model to prioritize phone call reminders to patients at high risk of non-attendance significantly reduced the non-attendance rate.