Fundoscopy, or ophthalmoscopy, is a medical procedure used to examine the inner structures of the eye. Fundoscopic images are valuable resources for developing artificial intelligence systems to aid in the diagnosis and management of eye conditions. This paper focuses on enhancing the robustness and generalizability of machine learning-based retinal image classification systems. A diverse and large-scale dataset of approximately 100,000 retinal images was utilized, along with a complex machine learning model. The study employed multiple datasets, including Kim's Eye Hospital, Drishti-GS1, DR HAGIS, APTOS 2019 Blindness Detection, ACRIMA, and Diabetic Retinopathy Detection 2015, to evaluate the performance of the model. Preprocessing techniques, including contrast enhancement and image resizing, were applied to prepare the dataset. The DenseNet121 model, which addresses the vanishing gradient problem, was used for transfer learning. The model created in this study can classify fundus images to three classes of Diabetic retinopathy, Glaucoma, and healthy eye with an average accuracy of 84.78%, a precision of 84.75%, and a recall of 84.76%. Although by training a model on a mild DR omitted dataset, these metrics increased significantly to an accuracy of 97.97%, a precision of 97.97%, and a recall of 97.96%. Results demonstrated that excluding mild diabetic retinopathy cases from the dataset significantly improved the model's performance.