Being bedridden is a frequent comorbid condition that leads to a series of complications in clinical practice. The present study aimed to predict bedridden duration of hospitalized patients based on EMR at admission by machine learning. The medical data of 4345 hospitalized patients who were bedridden for at least 24 hours after admission were retrospectively collected. After preprocessing of the data, features for modeling were selected by support vector machine recursive feature elimination. Thereafter, logistic regression, support vector machine, and extreme gradient boosting algorithms were adopted to predict th e bedridden duration. The feasibility and efficacy of above models were evaluated by performance indicators. Our results demonstrated that the most important features related to bedridden duration were Charlson Comorbidity Index, age, bedridden duration before admission, mobility capability, and perceptual ability. The extreme gradient boosting algorithm showed the best performance (accuracy, 0.797; area under the curve, 0.841) when compared with support vector machine (accuracy, 0.771; area under the curve, 0.803) and logistic regression (accuracy, 0.765; area under the curve, 0.809) algorithms. Meanwhile, the extreme gradient boosting algorithm had a higher sensitivity (0.856), specificity (0.650), and F1 score (0.858) than that of support vector machine algorithm (0.843, 0.589, and 0.841) and logistic regression (0.852, 0.545, and 0.839), respectively. These findings indicate that machine learning based on EMRs at admission is a feasible avenue to predict the bedridden duration. The extreme gradient boosting algorithm shows great potential for further clinical application.