Trametes robiniophila Murr. (Huaier) is a traditional medicinal fungus known for its pharmacological properties, including heat-clearing, detoxifying, anti-inflammatory, and antitumor effects. Our previous research has demonstrated its antiviral activity, but the exact therapeutic mechanisms remain unclear. This study aims to explore the mechanisms of 50 % methanol extract of Huaier (HME) in treating influenza using 16S rRNA high-throughput sequencing and metabolomics techniques. The results showed that the HME significantly reduced the lung index and viral load in the lungs of influenza-infected mice, alleviated pathological damage in lung tissues, and downregulated the expression levels of inflammatory cytokines Interleukin-6 (IL-6), Tumor Necrosis Factor-α (TNF-α) and Interferon-γ (IFN-γ) in lung tissues. Furthermore, the HME enhanced the diversity of gut microbiota in infected mice, significantly increasing the relative abundance of beneficial bacteria, such as Alistipes and Alloprevotella. Through non-targeted metabolomic analysis of mouse feces, 45 potential biomarkers were identified. Meanwhile, the low-dose of HME was able to restore the disrupted metabolic levels. Analysis of gut microbiota and biomarker pathways revealed that HME primarily affects nicotinate and nicotinamide metabolism, which may be the key mechanism for its intervention in influenza. In addition, Spearman correlation analysis showed that most biomarkers were significantly associated with pharmacodynamics and the Alloprevotella.