The rapid growth of the global population has increased the demand for sustainable agricultural production,necessitating efficient pest monitoring systems. Traditional pest detection methods rely on manual inspection or conventionalmachine learning approaches, which are often time-consuming, less accurate, and incapable of handling complex datasets. Thisstudy proposes a novel hybrid attention-based deep convolutional neural network (HA-DCNN) integrated with a modifiedpoolingstrategy for automatic pest detection and pesticide recommendation. The proposed model incorporates advanced preprocessing,adaptive background subtraction using tunable k-means clustering, and multi-level feature extraction combiningstatistical,textural, and deep features. Experimental evaluation demonstrates that the proposed approach achieves superior performanceinterms of accuracy, sensitivity, and specificity compared to existing models. Additionally, the system provides precisepesticiderecommendations, reducing excessive chemical usage and environmental impact. The proposed framework offers ascalableandintelligent solution for precision agriculture, improving crop productivity and sustainability. Keywords Pest Detection, DeepLearning, Convolutional Neural Network, Hybrid Attention, Precision Agriculture, Pesticide Recommendation