Metabolic dysfunction‐associated fatty liver disease (MAFLD) can coexist with chronic viral hepatitis. MAFLD is a heterogeneous disease because the diagnostic criteria include various metabolic traits. We aimed to identify patients at high risk of poor long‐term outcomes based on MAFLD subgroups in chronic viral hepatitis patients. We evaluated 63 273 chronic hepatitis B and C patients. Patient with a fatty liver index ≥30 was defined to have hepatic steatosis. MAFLD was defined as the presence of hepatic steatosis with any one of the following three conditions, overweight/obesity, type 2 diabetes or ≥2 metabolic risk factors. The prevalence of MAFLD was 38.4% (n = 24 290). During a median 8.8‐year follow‐up, 1839 HCCs and 2258 deaths were documented in MAFLD patients. Among MAFLD patients, diabetes could identify patients at high risk of HCC and mortality, whereas overweight/obesity and metabolic risk factors did not. Compared with non‐MAFLD patients, risk of HCC and mortality was significantly higher in diabetic MAFLD patients (adjusted hazard ratio [aHR] = 1.34, 95% confidence interval [CI] = 1.26‐1.43 for HCC; aHR = 1.15, 95% CI = 1.08‐1.22 for mortality). Risk of HCC and mortality was significantly higher in diabetic MAFLD patients (aHR = 1.40, 95% CI = 1.26‐1.55 for HCC; aHR = 1.77, 95% CI = 1.63‐1.93 for mortality) compared with non‐diabetic MAFLD patients. Diabetic MAFLD is associated with increased risk of HCC and mortality among chronic viral hepatitis patients. Our findings highlight the need for close surveillance and effective treatment for these high‐risk patients to reduce HCC and mortality in patients with chronic viral hepatitis.