To address the real-time detection challenge of deploying deep learning-based tomato leaf disease detection algorithms on embedded devices, an improved tomato leaf disease detection algorithm based on YOLOv8n is proposed in this paper. It is able to achieve the efficient, real-time detection of tomato leaf diseases while maintaining model’s lightweight requirements. The algorithm incorporated the LMSM (lightweight multi-scale module) and ALSA (Attention Lightweight Subsampling Module) to improve the ability to extract lightweight and multi-scale semantic information for the specific characteristics of tomato leaf disease, which include irregular spot size and lush tomato leaves. The head network was redesigned utilizing partial and group convolution along with a parameter-sharing method. Scalable auxiliary bounding box and loss function optimization strategies were introduced to further enhance performance. After undergoing the pruning technique, computation decreased by 61.7%, the model size decreased by 55.6%, and the FPS increased by 44.8%, all while a high level of accuracy was maintained. A detection speed of 19.70FPS on the Jetson Nano was obtained after undergoing TensorRT quantization, showing a 64.85% improvement compared to the initial detection speed. This method met the high real-time performance and small model size requirements for embedded tomato leaf disease detection systems, indirectly reducing the energy consumption of online detection. It provided an effective solution for the online detection of tomato leaf disease.