[Objective] Apple Alternaria leaf spot can easily lead to premature defoliation of apple tree leaves, thereby affecting the quality and yield of apples. Consequently, accurately detecting of the disease has become a critical issue in the precise prevention and control of apple tree diseases. Due to factors such as backlighting, traditional image segmentation-based methods for detecting disease spots struggle to accurately identify the boundaries of diseased areas against complex backgrounds. There is an urgent need to develop new methods for detecting apple Alternaria leaf spot, which can assist in the precise prevention and control of apple tree diseases. [Methods] A novel detection method named Deep Semi-Non-negative Matrix Factorization-based Mahalanobis Distance Anomaly Detection (DSNMFMAD) was proposed, which combines Deep Semi-Non-negative Matrix Factorization (DSNMF) with Mahalanobis distance for robust anomaly detection in complex image backgrounds. The proposed method began by utilizing DSNMF to extract low-rank background components and sparse anomaly features from the apple Alternaria leaf spot images. This enabled effective separation of the background and anomalies, mitigating interference from complex background noise while preserving the non-negativity constraints inherent in the data. Subsequently, Mahalanobis distance was employed, based on the Singular Value Decomposition (SVD) feature subspace, to construct a lesion detector. The detector identified lesions by calculating the anomaly degree of each pixel in the anomalous regions. The apple tree leaf disease dataset used was provided by PaddlePaddle AI-Studio. Each image in the dataset has a resolution of 512×512 pixels, in RGB color format, and was in JPEG format. The dataset was captured in both laboratory and natural environments. Under laboratory conditions, 190 images of apple leaves with spot-induced leaf drop were used, while 237 images were collected under natural conditions. Furthermore, the dataset was augmented with geometric transformations and random changes in brightness, contrast, and hue, resulting in 1 145 images under laboratory conditions and 1 419 images under natural conditions. These images reflect various real-world scenarios, capturing apple leaves at different stages of maturity, in diverse lighting conditions, angles, and noise environments. This diversed dataset ensured that the proposed method could be tested under a wide range of practical conditions, providing a comprehensive evaluation of its effectiveness in detecting apple Alternaria leaf spot. [Results and Discussions] DSNMFMAD demonstrated outstanding performance under both laboratory and natural conditions. A comparative analysis was conducted with several other detection methods, including GRX (Reed-Xiaoli detector), LRX (Local Reed-Xiaoli detector), CRD (Collaborative-Representation-Based Detector), LSMAD (LRaSMD-Based Mahalanobis Distance Detector), and the deep learning model Unet. The results demonstrated that DSNMFMAD exhibited superior performance in the laboratory environment. The results demonstrated that DSNMFMAD attained a recognition accuracy of 99.8% and a detection speed of 0.087 2 s/image. The accuracy of DSNMFMAD was found to exceed that of GRX, LRX, CRD, LSMAD, and Unet by 0.2%, 37.9%, 10.3%, 0.4%, and 24.5%, respectively. Additionally, the DSNMFMAD exhibited a substantially superior detection speed in comparison to LRX, CRD, LSMAD, and Unet, with an improvement of 8.864, 107.185, 0.309, and 1.565 s, respectively. In a natural environment, where a dataset of 1 419 images of apple Alternaria leaf spot was analysed, DSNMFMAD demonstrated an 87.8% recognition accuracy, with an average detection speed of 0.091 0 s per image. In this case, its accuracy outperformed that of GRX, LRX, CRD, LSMAD, and Unet by 2.5%, 32.7%, 5%, 14.8%, and 3.5%, respectively. Furthermore, the detection speed was faster than that of LRX, CRD, LSMAD, and Unet by 2.898, 132.017, 0.224, and 1.825 s, respectively. [Conclusions] The DSNMFMAD proposed in this study was capable of effectively extracting anomalous parts of an image through DSNMF and accurately detecting the location of apple Alternaria leaf spot using a constructed lesion detector. This method achieved higher detection accuracy compared to the benchmark methods, even under complex background conditions, demonstrating excellent performance in lesion detection. This advancement could provide a valuable technical reference for the detection and prevention of apple Alternaria leaf spot.