Diabetes mellitus is one of the most common chronic diseases, the number of patients with which continues to grow, which necessitates constant monitoring of patients' condition. A recognized indicator of the quality of medical care is the rate of readmission, the level of which for patients with diabetes mellitus exceeds the corresponding rate among hospital patients as a whole. Existing systems for monitoring the condition of patients with diabetes mellitus only partially fulfill the task of timely identification of patients at risk of deterioration: they are focused on patient self-monitoring, processing a narrow set of indicators, or storing medical records without the functionality of condition analysis. The bulk of scientific research in this area is focused on comparing the effectiveness of machine learning models, while the issues of data preparation and feature formation are covered to a lesser extent. The aim of the article is to substantiate a method for predicting the risk of hospitalization of a patient with diabetes mellitus based on ensemble learning, taking into account class imbalance and incompleteness of input data. The problem is formalized as a probabilistic binary classification, the target variable is the rate of readmission, and class imbalance is taken into account by weighting classes in the loss function. The method consists of a sequence of steps. First, a feature vector is formed from heterogeneous clinical indicators. The absence of a laboratory test result is considered as a separate informative feature, and not a random omission, since the doctor's decision not to conduct the test in itself carries clinically significant information. Diagnoses are combined into pathology groups and encoded using the one-hot method, which reduces the dimensionality of the feature space without losing clinical significance. To predict the risk of hospitalization, a class of ensemble learning methods based on decision trees was selected; the specific method is determined at the stage of experimental research. In conditions of class imbalance, the use of sensitivity, accuracy, and integral quality metrics of class separation instead of the proportion of correct classifications is justified. It is proposed to translate the assessment of the probability of hospitalization into three levels of clinical risk, the boundaries between which are not fixed and are subject to calibration taking into account clinical priority. The proposed method is not tied to a specific ensemble algorithm and can be used as the basis for a module for predicting the risk of hospitalization in information systems for monitoring the condition of patients with diabetes mellitus.