The pathogenesis of diabetic kidney disease (DKD) is complex, and the existing treatment methods cannot control disease progression well. Macrophages play an important role in the development of DKD. This study aimed to search for biomarkers involved in immune injury induced by macrophages in DKD. The GSE96804 dataset was downloaded and analyzed by the CIBERSORT algorithm to understand the differential infiltration of macrophages between DKD and normal controls. Weighted gene co-expression network analysis was used to explore the correlation between gene expression modules and macrophages in renal tissue of DKD patients. Protein-protein interaction network and machine learning algorithm were used to screen the hub genes in the key modules. Subsequently, the GSE30528 dataset was used to further validate the expression of hub genes and analyze the diagnostic effect by the receiver operating characteristic curve. The clinical data were applied to explore the prognostic significance of hub genes. CIBERSORT analysis showed that macrophages increased significantly in DKD renal tissue samples. A total of ten modules were generated by weighted gene co-expression network analysis, of which the blue module was closely associated with macrophages. The blue module mainly played an important role in biological processes such as immune response and fibrosis. Fibronectin 1 (FN1) and transforming growth factor beta induced (TGFBI) were identified as hub genes of DKD patients. Receiver operating characteristic curve analysis was performed in the test cohort: FN1 and TGFBI had larger area under the curve values (0.99 and 0.88, respectively). Clinical validation showed that 2 hub genes were negatively correlated with the estimated glomerular filtration rate in DKD patients. In addition, FN1 and TGFBI showed a strong positive correlation with macrophage alternative activation. FN1 and TGFBI are promising biomarkers for the diagnosis and treatment of DKD patients, which may participate in immune response and fibrosis induced by macrophages.