Early Plant disease diagnosis is necessary for several purposes, including reducing yield losses, monitoring and predicting infections, detecting host resistance, and studying basic host‐pathogen biological processes. However early detection has been limited a trained workforce and the ability to identify the problem early in the growing season. Artificial intelligence / machine learning algorithms can help fill this gap. Automatic leaf detection using machine learning is proposed in this study. The presented approach of three stages namely, pre‐processing, feature extraction, and classification. Initially, the input image is transformed into the red, green, and blue format, and the noise in the green band is removed using a median filter. Then, important features of the green band are extracted. After feature extraction, the extracted features are fed to the Optimized Artificial Neural Network (OANN) classifier to classify an image as normal or diseased. To improve Artificial Neural Network (ANN) performance, the Artificial Neural Network (ANN) parameters are chosen optimally using the Adaptive Sunflower Optimization (ASFO) algorithm. Then, the infected region is separated using a level set segmentation algorithm. The efficiency of our work is analyzed based on accuracy, sensitivity, and specificity, the proposed method reached the maximum accuracy of 97.94% for plant disease prediction.This article is protected by copyright. All rights reserved