Individuals with psychiatric disorders are vulnerable to adverse mental health outcomes following physical illness. This longitudinal cohort study defined risk profiles for readmission for suicidal behavior and self-harm after general hospitalization of adults with serious mental illness. Structured electronic health record data were analyzed from 15,644 general non-psychiatric index hospitalizations of individuals with depression, bipolar, and psychotic disorders admitted to an urban health system in the southwestern United States between 2006 and 2017. Using data from one-year prior to and including index hospitalization, supervised machine learning was implemented to predict risk of readmission for suicide attempt and self-harm in the following year. The Classification and Regression Tree algorithm produced a classification prediction with an area under the receiver operating curve (AUC) of 0.86 (95% confidence interval (CI) 0.74-0.97). Incidence of suicide-related behavior was highest after general non-psychiatric hospitalizations of individuals with prior suicide attempt or self-harm (18%; 69 cases/389 hospitalizations) and lowest after hospitalizations associated with very high medical morbidity burden (0 cases/3090 hospitalizations). Predictor combinations, rather than single risk factors, explained the majority of risk, including concomitant alcohol use disorder with moderate medical morbidity, and age ≤55-years-old with low medical morbidity. Findings suggest that applying an efficient and highly interpretable machine learning algorithm to electronic health record data may inform general hospital clinical decision support, resource allocation, and preventative interventions for medically ill adults with serious mental illness.