This study aimed to examine whether the diagnostic accuracy of four noninvasive tests (NITs) for detecting advanced fibrosis in nonalcoholic fatty liver disease (NAFLD) is maintained or is inferior to with or without the presence of type 2 diabetes. Overall, 874 patients with biopsy‐proven NAFLD were enrolled. After propensity‐score matching by age, sex, and the prevalence of dyslipidemia, 311 patients were enrolled in each group of with or without diabetes. To evaluate the effect of diabetes, we compared the diagnostic accuracy of the fibrosis‐4 (FIB‐4) index, the NAFLD fibrosis score (NFS), the aspartate aminotransferase to platelet ratio index (APRI), and type IV collagen 7S (COL4‐7S) in patients with NAFLD with and without diabetes. The areas under the receiver operating characteristic curve (AUROC) for identifying advanced fibrosis in patients without diabetes were 0.879 for the FIB‐4 index, 0.851 for the NFS, 0.862 for the APRI, and 0.883 for COL4‐7S. The AUROCs in patients with diabetes were 0.790 for the FIB‐4 index, 0.784 for the NFS, 0.771 for the APRI, and 0.872 for COL4‐7S. The AUROC of COL4‐7S was significantly larger than that of the other NITs in patients with NAFLD with diabetes than in those without diabetes. The optimal high and low cutoff points of COL4‐7S were 5.9 ng/mL and 4.8 ng/mL, respectively. At the low cutoff point, the accuracy of COL4‐7S was better than that of the other NITs, especially in patients with diabetes. Conclusion: COL4‐7S measurement might be the best NIT for identifying advanced fibrosis in NAFLD, especially in NAFLD with diabetes.