To solve the challenges of low detection accuracy of maize pests and diseases, complex detection models, and difficulty in deployment on mobile or embedded devices, an improved YOLOv8 algorithm was proposed. Based on the original YOLOv8n, the algorithm replaced the Conv module with the DSConv module in the backbone network, which reduced the backbone network parameters and computational load and improved the detection accuracy at the same time. Additionally, BiFPN was introduced to construct a bidirectional feature pyramid structure, which realized efficient information flow and fusion between different scale features and enhanced the feature fusion ability of the model. At the same time, the Wise-IoU loss function was combined to optimize the training process, which improved the convergence speed and regression accuracy of the loss function. The experimental results showed that the precision, recall, and mAP0.5 of the improved algorithm were improved by 1.4, 1.1, and 1.5%, respectively, compared with YOLOv8n, and the model parameters and computational costs were reduced by 6.6 and 7.3%, respectively. The experimental results demonstrate the effectiveness and superiority of the improved YOLOv8 algorithm, which provides an efficient, accurate, and easy-to-deploy solution for maize leaf pest detection.