Diabetic retinopathy (DR) is recognized as a major pathological contributor to blindness, and timely screening is required to prevent progressive sight loss. Modern computer vision strategies formalize DR severity assessment as a multi-class classification problem. Supervised end-to-end models have achieved promising results, but two key challenges remain. Firstly, imbalanced data distributions cause end-to-end models to favor the dominant categories, limiting the precise detection of infrequent categories. Secondly, effectively modeling the inherent ordinal relationships between different severity levels is essential for achieving accurate and consistent classification. This work introduces a contrastive learning framework for DR grading, consisting of a k-positive contrast branch and a novel ordinal adjustment marginal classification branch, to address the two challenges in DR grading. On three challenging DR grading datasets, the proposed method achieves competitive and consistent performance, comparing favorably with existing approaches. Specifically, on APTOS2019, our method achieves an accuracy of 86.69% and a weighted Kappa of 92.50%. On Messidor-2, it attains an accuracy of 81.91% and a weighted Kappa of 87.28%. Meanwhile, on the DDR dataset, it records an accuracy of 83.16% and a weighted Kappa of 84.57%. Extensive experiments demonstrate the effectiveness of our method and its potential for generalization to other imbalanced ordinal classification tasks. Code will be released at https://github.com/liluhu0/KCOC.