Potentially inappropriate prescribing (PIP), including potentially inappropriate medications (PIMs) and potential prescribing omissions (PPOs), is a major risk factor for adverse drug reactions (ADRs). Establishing a risk warning model for PIP to screen high-risk patients and implementing targeted interventions would significantly reduce the occurrence of PIP and adverse drug events. Elderly patients with cardiovascular disease hospitalized at the Sichuan Provincial People’s Hospital were included in the study. Information about PIP, PIM, and PPO was obtained by reviewing patient prescriptions according to the STOPP/START criteria (2nd edition). Data were divided into a training set and test set at a ratio of 8:2. Five sampling methods, three feature screening methods, and eighteen machine learning algorithms were used to handle data and establish risk warning models. A 10-fold cross-validation method was employed for internal validation in the training set, and the bootstrap method was used for external validation in the test set. The performances were assessed by area under the receiver operating characteristic curve (AUC), and the risk warning platform was developed based on the best models. The contributions of features were interpreted using SHapley Additive ExPlanation (SHAP). A total of 404 patients were included in the study (318 [78.7%] with PIP; 112 [27.7%] with PIM; and 273 [67.6%] with PPO). After data sampling and feature selection, 15 datasets were obtained and 270 risk warning models were built based on them to predict PIP, PPO, and PIM, respectively. External validation showed that the AUCs of the best model for PIP, PPO, and PIM were 0.8341, 0.7007, and 0.7061, respectively. The results suggested that angina, number of medications, number of diseases, and age were the key factors in the PIP risk warning model. The risk warning platform was established to predict PIP, PIM, and PPO, which has acceptable accuracy, prediction performance, and potential clinical application perspective.