Background and AimsThe immune microenvironment (IME) plays a crucial role in the progression of hepatocellular carcinoma (HCC). In HCC, the IME is often compromised by hepatitis B virus (HBV) infection, chronic inflammation, and fibrosis. Both antiviral therapy (AVT) and the alleviation of inflammation and fibrosis (AIF) have been shown to improve prognosis. However, the relationship among the IME of HCC, AVT, and AIF remains unclear.MethodsA total of 140 and 110 primary HBV‐related HCC patients were enrolled as training and validation sets, respectively, to establish a HCC‐immune microenvironment score (H‐IME score). Immunohistochemistry was performed to assess the number of granzyme B+ (GrB+) and Foxp3+ cells, as well as the expression of CTLA‐4, PD‐1, LAG3, TIGIT, TIM3, and VISTA. Another cohort consisting of 114 recurrent HBV‐related HCC patients with paired primary and recurrent tissues was used to study the relationship among the IME of HCC, AVT, and AIF.ResultsThe H‐IME score, including GrB, Foxp3, CTLA‐4, PD‐1, LAG3, and TIGIT, was established to evaluate the IME. A higher H‐IME score indicates stronger immunosuppressive activities. Both AVT and AIF were found to inhibit immunosuppressive activities in the IME. Compared to primary tumors, the H‐IME scores of recurrent tumors in the effective AVT group (e‐AVT, classified by HBV DNA) with AIF decreased, while the scores increased in the non‐AVT group without AIF.ConclusionsThe IME of HCC is closely related to AVT and AIF. e‐AVT can enhance anti‐tumor activities in the IME by alleviating inflammation and fibrosis.