Pine wilt disease (PWD) is one of the most destructive diseases for pine trees, causing a significant effect on ecological resources. The identification of PWD-infected trees is an effective approach for disease control. However, the effects of complex environments and the multi-scale features of PWD trees hinder detection performance. To address these issues, this study proposes a detection model based on PWD-YOLOv8 by utilizing aerial images. In particular, the coordinate attention (CA) and convolutional block attention module (CBAM) mechanisms are combined with YOLOv8 to enhance feature extraction. The bidirectional feature pyramid network (BiFPN) structure is used to strengthen feature fusion and recognition capability for small-scale diseased trees. Meanwhile, the lightweight FasterBlock structure and efficient multi-scale attention (EMA) mechanism are employed to optimize the C2f module. In addition, the Inner-SIoU loss function is introduced to seamlessly improve model accuracy and reduce missing rates. The experiment showed that the proposed PWD-YOLOv8n algorithm outperformed conventional target-detection models on the validation set (mAP@0.5 = 94.3%, precision = 87.9%, recall = 87.0%, missing rate = 6.6%; model size = 4.8 MB). Therefore, the proposed PWD-YOLOv8n model demonstrates significant superiority in diseased-tree detection. It not only enhances detection efficiency and accuracy but also provides important technical support for forest disease control and prevention.