To address the challenges of high similarity in height between young fruits and leaves, small size of fruits, dense distribution, and severe occlusions, this paper proposes a lightweight YOLOv8s-P detection model for the identification of young fruits of "Okubo" peaches in complex environments. Firstly, the lightweight C2f_Faster module is designed and replaces all the C2f modules in YOLOv8s to realize the model lightweight. Secondly, the Efficient Multi-Scale Attention Module(EMA) is added inside the C2f_Faster module of the lightweight model to enhance the network's ability to extract tiny features. Finally, the MPDIoU boundary loss function based on the minimum point is used to replace the original CIoU boundary loss function of YOLOv8s to improve the positioning accuracy of the model prediction box. The results demonstrate that the YOLOv8s-P model achieves an average precision (AP@0.5) of 90.86%, F1 score of 86.70%, while only occupying 75.23% of the size of YOLOv8s. Compared to other lightweight algorithms such as YOLOv3-tiny, YOLOv4-tiny, YOLOv5s, YOLOv6s, YOLOv7-tiny, and YOLOv8s the YOLOv8s-P model achieves higher AP@0.5 by 6.26%, 6.01%, 2.05%, 2.12%, 1.87%, and 1.85% respectively. Additionally, the F1 score is higher by 3.93%, 3.42%, 1.54%, 1.52%, 0.68%, and 0.85% respectively. In conclusion, the YOLOv8s-P model has higher detection accuracy, compressed model size, and reduced hardware equipment configuration requirements, which provides a reference for the subsequent deployment and application of the "Okubo" peach fruit thinning robot hardware equipment.