Objective To explore the relevant predictors of unplanned readmission within 30 days after discharge in patients with liver cirrhosis, construct a risk prediction model based on the random forest algorithm, and preliminarily evaluate its predictive performance. Methods A retrospective analysis was conducted, and the clinical data of 292 patients with liver cirrhosis who were hospitalized in a specialized hospital in Nanning from May 2023 to January 2024 were collected. The patients were divided into two groups according to whether unplanned readmission occurred within 30 days after discharge. Univariate analysis and random forest model were used to screen predictive variables, and a predictive model was constructed. The area under the receiver operating characteristic (ROC) curve (AUC), accuracy, recall, and specificity were employed to evaluate the performance of the model on the independent validation set. Results Among the 292 patients, 86 (29.45%) had unplanned readmission within 30 days after discharge. The top 5 important predictive variables screened by the random forest prediction model were in the following order: Model for End-Stage Liver Disease (MELD) score, monocyte/lymphocyte ratio (MLR), activated partial thromboplastin time (APTT), alanine aminotransferase (ALT), and age. On the validation set, the model achieved an ROC AUC of 0.746 9, a recall (sensitivity) of 1.00, a specificity of 0.91, an overall accuracy of 0.84, and a precision of approximately 0.92. Conclusion The preliminarily constructed random forest prediction model in this study shows a certain predictive potential for the short-term readmission risk of patients with liver cirrhosis, and the screened predictive variables have clinical reference value. However, the performance of the model still needs to be optimized, and the conclusions need to be further verified by larger-sample and multi-center external data.