For patients with sentinel lymph node (SLN) metastasis and low risk of residual non-SLN (NSLN) metastasis, axillary lymph node (ALN) dissection could lead to overtreatment. This study aimed to develop and validate an automated preoperative deep learning-based tool to predict the risk of SLN and NSLN metastasis in patients with breast cancer (BC) using dynamic contrast-enhanced magnetic resonance imaging (DCE-MRI) images. In this machine learning study, we retrospectively enrolled 988 women with BC from three hospitals in Zhejiang, China between June 1, 2013 to December 31, 2021, June 1, 2017 to December 31, 2021, and January 1, 2019 to June 30, 2023, respectively. Patients were divided into the training set (n=519), internal validation set (n=129), external test set 1 (n=296), and external test set 2 (n=44). A convolutional neural network (CNN) model was proposed to predict the SLN and NSLN metastasis and was compared with clinical and radiomics approaches. The performance of different models to detect ALN metastasis was measured by the area under the curve (AUC), accuracy, sensitivity, and specificity. This study is registered at ChiCTR, ChiCTR2300070740. For SLN prediction, the top-performing model (i.e., the CNN algorithm) achieved encouraging predictive performance in the internal validation set (AUC 0.899, 95% CI, 0.887-0.911), external test set 1 (AUC 0.885, 95% CI, 0.867-0.903), and external test set 2 (AUC 0.768, 95% CI, 0.738-0.798). For NSLN prediction, the CNN-based model also exhibited satisfactory performance in the internal validation set (AUC 0.800, 95% CI, 0.783-0.817), external test set 1 (AUC 0.763, 95% CI, 0.732-0.794), and external test set 2 (AUC 0.728, 95% CI, 0.719-0.738). Based on the subgroup analysis, the CNN model performed well in tumour group smaller than 2.0cm, with the AUC of 0.801 (internal validation set) and 0.823 (external test set 1). Of 469 patients with BC, the false positive rate of SLN prediction declined from 77.9% to 32.9% using CNN model. The CNN model can predict the SLN status of any detectable lesion size and condition of NSLN in patients with BC. Overall, the CNN model, employing ready DCE-MRI images could serve as a potential technique to assist surgeons in the personalized axillary treatment of in patients with BC non-invasively. National Key Research and Development projects intergovernmental cooperation in science and technology of China, National Natural Science Foundation of China, Natural Science Foundation of Zhejiang Province, and Zhejiang Medical and Health Science Project.