Abstract The United Nations’ Sustainable Development Goals, SDG 12: Responsible Consumption and Production, and SDG 13: Climate Action highlight the importance of environmental conservation and reducing pesticide use. Early and accurate pest identification is essential for implementing targeted pest control measures, which helps reduce unnecessary and incorrect pesticide use. While effective pest recognition and classification are crucial for ecological research and biodiversity conservation, traditional methods remain labor-intensive, time-consuming, and dependent on experts. Several deep learning techniques have been introduced in recent years, leading to more efficient and accurate identification and classification of crop pests. This research presents a structurally adapted DenseNet model for multi-class pest image classification based on dense connections. The model is fine-tuned through hyperparameters involving dense blocks and transition layers to perform consistently across three different datasets, including the IP102 dataset, which contains over 75,000 images of 102 pest species. The study also addresses dataset imbalance to prevent biased outcomes by deep learning models. The proposed structurally adapted model for fine-grained classification achieves 82.69% accuracy and 81.45% F1 score on the IP102 dataset, complementing existing advanced methods. Similar content being viewed by others Funding Open access funding provided by Manipal University Jaipur. The authors received no funding for this work. Author information Authors and Affiliations Corresponding author Ethics declarations Competing interests The authors declare no competing interests. Additional information Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations. Rights and permissions Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or