Agriculture serves as the mainstay of India's economy, bearing a vital responsibility in nourishing an expanding populace. The thriving of this sector is contingent upon numerous variables, among which the choice of the optimal crop plays a pivotal role. The advent of Machine Learning (ML) has engendered a transformative impact on the agricultural sector by facilitating the prediction of suitable crops, contingent on soil attributes. This study undertakes the examination of diverse ML algorithms, encompassing Decision Tree, Linear Regression, Naï ve Bayes, Random Forest, Extreme Gradient Boosting (XGBoost), and Support Vector Machine, to assess their efficacy in recommending optimal crops based on soil parameters. The parameters under consideration include Phosphorus, Nitrogen, Potassium, Electrical Conductivity, pH, Organic Carbon, Boron, Iron, Zinc, Copper, Manganese, and Sulphur. The crop recommendations are focused on Rice, Cotton, and Jowar for the Kurnool district of Andhra Pradesh, India. Among the assessed models, it was observed that the XGBoost model surpassed others in terms of accuracy in determining the most suitable crop for the given soil parameters. The experimental findings substantiate the precision of the model in forecasting the apt crop, thereby underscoring the immense potential of ML in the agricultural domain. This investigation signifies a considerable stride towards optimal crop recommendation, thereby increasing the potential for enhanced yield and profitability. Through the incorporation of technological innovation, agriculture can be rendered more efficient, cost-effective, and sustainable, thus laying the groundwork for a promising future.