When using machine learning to predict a class with a continuous numeric value, there are several issues. Only a few machine-learning approaches are capable of doing so, but it remains one of the most difficult jobs to do. In this paper, we show how to use the M5 Model Tree, an approach that can handle continuous numeric data. This method is a stepwise procedure that employs linear functions at the leaf nodes of any created decision tree inducer (such as CART). These M5 model trees provide basic practical formulas such as standard deviation (SD), standard deviation reduction (SDR), cost-complexity pruning (CCP), and so on, which may be simply applied to different benchmark data by another user. This study examines the M5 Model Tree algorithm's capabilities for analysing rainfall data in the Kashmir portion of India's Union Territory of Jammu & Kashmir. One of the best suited models was the M5 model tree, which was built using (70–30) percent training and test ratios, respectively, and predicted an RMSE of 2.593, an MAE of 1.68, and a correlation coefficient (R2) of 0.478. Furthermore, M5 model trees produce models with a minimal number of trails, requiring less computing effort and making them more practical to use.