The automatic recognition and classification of infected plant leaves play an important role in precision agriculture and in helping to improve crop yields. With the advancements in the fields of artificial intelligence and computer vision, an exponential progress has been observed in their applications to agriculture, such as in plant leaf disease detection and subsequent decision making. However, the complexity and diversity in the structural background of plant leaf images pose several challenges. This article introduces a novel bag-of-features algorithm, called Upgraded Slime mould Algorithm-Bag of Features (USMA-BOF) , for an effective classification of plant leaf images. The stochastic-based upgraded USMA is proposed to determine the optimal visual words. Further, the occurrence or repetition of optimal visual features is represented through a new discrete dual complex chirplet transform (DDCCT) method. Finally, the classification is performed using two classifiers: a support vector machine (SVM) and a multilayer perceptron (MLP). The performance of USMA is first compared with state-of-the-art algorithms on IEEE Congress on Evolutionary Computation (CEC) 2017 benchmark functions. Then, the proposed USMA-BOF algorithm is applied on a classification dataset with binary outputs for disease identification in sustainable agriculture. The MLP classifier performs better than SVM, with an average accuracy of 0.7552 using the proposed USMA-BOF algorithm, as compared to 0.7262, 0.6989, 0.6343, and 0.7262 using the algorithms whale optimization algorithm (WOA)-BOF, adaptive particle swarm optimization (APSO)-BOF, gray wolf optimization (GWO)-BOF, and SMA-BOF, respectively.