Millions of people across the world are suffering from diabetic retinopathy. This disease majorly affects the retina of the eye, and if not identified priorly causes permanent blindness. Hence, detecting diabetic retinopathy at an early stage is very important to safeguard people from blindness. Several machine learning (ML) algorithms are implemented on the dataset of diabetic retinopathy available in the UCI ML repository to detect the symptoms of diabetic retinopathy. But, most of those algorithms are implemented individually. Hence, this article proposes an effective integrated ML approach that uses the support vector machine (SVM), principal component analysis (PCA), and moth-flame optimization techniques. Initially, the ML algorithms decision tree (DT), SVM, random forest (RF), and Naïve Bayes (NB) are applied to the diabetic retinopathy dataset. Among these, the SVM algorithm is outperformed with an average of 76.96% performance. Later, all the aforementioned ML algorithms are implemented by integrating the PCA technique to reduce the dimensions of the dataset. After integrating PCA, it is noticed that the performance of the algorithms NB, RF, and SVM is reduced dramatically; on the contrary, the performance of DT is increased. To improve the performance of ML algorithms, the moth-flame optimization technique is integrated with SVM and PCA. This proposed approach is outperformed with an average of 85.61% performance among all the other considered ML algorithms, and the classification of class labels is achieved correctly.