Idiopathic pulmonary fibrosis (IPF) is a chronic progressive lung disease with a poor prognosis. The current coronavirus disease 2019 (COVID-19) shares some similarities with IPF. SARS-CoV-2 related genes have been reported to be broadly regulated by N6-methyladenosine (m6A) RNA modification. Here, we identified the association between m6A methylation regulators, COVID-19 infection pathways, and immune responses in IPF. The characteristic gene expression networks and immune infiltration patterns of m6A-SARS-CoV-2 related genes in different tissues of IPF were revealed. We subsequently evaluated the influence of these related gene expression patterns and immune infiltration patterns on the prognosis/lung function of IPF patients. The IPF cohort was obtained from the Gene Expression Omnibus dataset. Pearson correlation analysis was performed to identify the correlations among genes or cells. The CIBERSORT algorithm was used to assess the infiltration of 22 types of immune cells. The least absolute shrinkage and selection operator (LASSO) and proportional hazards model (Cox model) were used to develop the prognosis prediction model. Our research is pivotal for further understanding of the cellular and genetic links between IPF and SARS-CoV-2 infection in the context of the COVID-19 pandemic, which may contribute to providing new ideas for prognosis assessment and treatment of both diseases.