Background: Soil fertility assessment is an important component of precision agriculture and smart farming systems. In earlier days, farmers used a traditional soil analysis process that was labor-intensive, time-consuming, and inadequate for real-time agricultural decision-making. In the modern era, farmers use advanced techniques such as smart agricultural sensors, IoT, and ML and DL techniques, which have enabled the development of intelligent soil profiling frameworks capable of improving soil management and agricultural production. However, class imbalance in soil datasets remains a significant difficulty that can impair prediction accuracy and model reliabilityObjective: In this paper, our main objective is to develop an intelligent soil fertility prediction framework using ML and data balancing techniques to address class imbalance issues in smart farming.Materials and Methods : The study used the publicly available Soil Fertility Dataset from Kaggle, which included 880 soil samples with 12 physicochemical soil parameters such as nitrogen (N), phosphorus (P), potassium (K), pH, electrical conductivity (EC), organic carbon (OC), sulfur (S), zinc (Zn), iron (Fe), copper (Cu), manganese (Mn), and boron (B). Several sampling methods, including SMOTE, ADASYN, RandomUnderSampler, and SMOTEENN, were used and compared against the original unsampled dataset due to class imbalance in the training data. In this paper, we also used the four ML models, such as RF,XGBoost, LightGBM, and SV, and evaluated them with the performance metrics and cross-validation metrics . One-way ANOVA and McNemar's test were used to further analyze statistical significance.Results: From our experimental observations, the combined approach (ADASYN sampling + RF) achieved the highest accuracy of 88.64%, F1-score of 0.8888, and Kappa score of 0.7923. As well as other models, RF performs consistently well. Apart from these, we also performed statistical tests, such as ANOVA, which revealed a significant difference in model performance (F = 5.1425, p = 0.0111).