AbstractDiabetic retinopathy (DR) is a retinal condition in which the blood vessels of the retina are damaged. If DR is not detected in its early stage, it can lead to visual impairment and even blindness. For DR diagnosis, ophthalmologists manually examine the condition of the retina using fundus images. This manual way of DR detection is cumbersome, error‐prone, and time‐consuming, and it requires skilled ophthalmologists. To address these issues, we propose a deep learning‐based hybrid model named XCapsNet, which combines the discriminative ability of the Xception and Capsule networks for automated detection of DR from the fundus images. In the proposed approach, we applied the CLAHE image preprocessing technique to improve the discriminative information in fundus images by enhancing the contrast of the images. Furthermore, in the proposed XCapNet model, we utilized the pretrained Xception and CapsNet models to learn the discriminative and hierarchically deep features of the DR fundus images at multiple labels of abstraction for diagnosing the DR disease. The performance of the proposed method is evaluated on the two publicly available APTOS2019 and Messidor datasets. The proposed method achieved a classification accuracy of 83.06% and 98.91% on the APTOS2019 dataset for multiclass and binary‐class classification of DR images, respectively. On the Messidor dataset, the proposed approach achieved an accuracy of 98.33% for the classification of fundus images into DR and Normal classes. Additionally, we have also investigated the performance of different pretrained CNN models for DR detection. The proposed method shows its superiority over the existing methods.