Soil fertility’s significance in agriculture profoundly affects the well-being of farmers. A novel technique is being introduced to gauge soil categorization levels, based on soil chemical data involving elements like “Nitrogen, Phosphorus, Potassium, PH value, Organic Carbon, Electrical Conductivity, Sulphur, Zinc, iron”, and more. Classification and regression methodologies are employed to predict soil categorization levels like low level, medium, and high level. The dataset for soil categorization analysis was collected from a farm within the Bhandara region of Maharashtra. The ultimate model’s efficacy was ascertained through a combination of soil analysis and meticulous refinement of hyper parameters in both random forest classification and regression approaches. In pursuit of an improved model, various alternative strategies for classification and regression were explored. Evaluation metrics, including OOB error rate, AUC accuracy, error rate, recall, precision, and F-score, were applied in the classification analysis. For the regression aspect, metrics such as mean squared error, r2 score, and error rate were employed. After subjecting the experimental dataset to thorough analysis using the random forest algorithm, accurate predictions of soil fertility levels were achieved with 93% accuracy of training and 83% accuracy of testing. This method offers a reliable pathway to enhance crop productivity.