Classification and evaluation of reservoirs conforming to geological characteristics are the proposed premises of the high‐quality development of unconsolidated sandstone heavy oil reservoirs. The P oilfield in Bohai Bay is one of the largest offshore oilfields in China, but the reservoirs are highly heterogeneous, have complex pore structures, and change fluid properties, which make the classification of reservoirs very difficult. At present, the most commonly used reservoir classification methods are based on the results of logging interpretation, which cannot eliminate the constraints of linear relationships such as empirical formulas. Machine learning has significant advantages for identifying reservoir classification problems that are complex and nonlinear with geological characteristics. First, this study fully considered the pore structure and fluid properties and selected four representative evaluation parameters. An improved K‐means method was used to establish a reservoir classification evaluation system. Characteristics, such as the sedimentary microfacies, pore structure and oilfield production performance, of different types of reservoirs were then analysed. Finally, six logging curves were selected as input results, reservoir classification was used as an output result, and XGBoost was used to carry out reservoir classification evaluation for the entire area. The accuracy of XGBoost was 85.35%. Furthermore, XGBoost was compared with three other machine learning methods to confirm its reliability. The results showed that the reservoirs in the study area can be divided into three types. Sandstone thickness and pore structure were the most important parameters that affected reservoir quality. Among various machine learning algorithms, XGBoost can accurately and quickly achieve a quantitative evaluation of reservoir quality.