Few studies have incorporated echocardiography and laboratory data to predict clinical outcomes in heart failure with preserved ejection fraction (HFpEF). This study aimed to use machine learning to find predictors of heart failure (HF) hospitalization and cardiovascular (CV) death in HFpEF. From the Chang Gung Research Database in Taiwan, 6,092 HFpEF patients (2,898 derivation, 3,194 validation) identified between 2008 and 2017 were followed until 2019. A random survival forest model, using 58 variables, was developed to predict the composite outcome of HF hospitalization and CV death. During 2.9-year follow-up, 37.7% of derivation and 36.0% of validation cohort patients experienced HF hospitalization or CV death. The study identified 15 predictive indicators, including age ≥65 years, B-type natriuretic peptide level ≥600 pg/mL, left atrium size ≥46 mm, atrial fibrillation, frequency of HF hospitalization within 3 years, body mass index <30 kg/m2, moderate or severe mitral regurgitation, left ventricular (LV) posterior wall thickness of <10 or ≥13 mm, dysnatremia, LV end-diastolic dimension of <40 or ≥56 mm, uric acid level ≥7 mg/dL, triglyceride level of <70 or ≥200 mg/dL, blood urea nitrogen level ≥20 mg/dL, interventricular septum thickness of <11 or ≥20 mm, and glycated hemoglobin (HbA1c) level of <6% or ≥8%. The random survival forest model demonstrated robust external generalizability with an 86.9% area under curve in validation. Machine learning identified 15 predictors of HF hospitalization and CV death in HFpEF patients, helping doctors identify high-risk individuals for tailored treatment.