Purpose. To predict visual acuity (VA) 1 month after anti-vascular endothelial growth factor (VEGF) therapy in patients with diabetic macular edema (DME) by using machine learning. Methods. This retrospective study included 281 eyes with DME receiving intravitreal anti-VEGF treatment from January 1, 2019, to April 1, 2021. Eighteen features from electronic medical records and measurements data from OCT images were extracted. The data obtained from January 1, 2019, to November 1, 2020, were used as the training set; the data obtained from November 1, 2020, to April 1, 2021, were used as the validation set. Six different machine learning algorithms were used to predict VA in patients after anti-VEGF therapy. After the initial detailed investigation, we designed an optimization model for convenient application. The VA predicted by machine learning was compared with the ground truth. Results. The ensemble algorithm (linear regression + random forest regressor) performed best in VA and VA variance predictions. In the validation set, the mean absolute errors (MAEs) of VA predictions were 0.137-0.153 logMAR (within 7-8 letters), and the mean square errors (MSEs) were 0.033-0.045 logMAR (within 2-3 letters) for the 1-month VA predictions, respectively. For the prediction of VA variance at 1 month, the MAEs were 0.164-0.169 logMAR (within 9 letters), and the MSEs were 0.056-0.059 logMAR (within 3 letters), respectively. Conclusions. Our machine learning models could accurately predict VA and VA variance in DME patients receiving anti-VEGF therapy 1 month after, which would be much valuable to guide precise individualized interventions and manage expectations in clinical practice.