Patients with COVID-19 and metabolic-dysfunction associated fatty liver disease (MAFLD) appear to be at higher risk for severe manifestations, especially in the youngest decades. Our aim was to examine whether patients with MAFLD and/or with increased liver fibrosis scores (FIB-4) are at risk for severe COVID-19 illness, using a machine learning (ML) model. Six hundred and seventy two patients were enrolled for SARS-CoV-2 pneumonia between February 2020 and May 2021. Steatosis was detected by ultrasound or computed tomography (CT). ML model valuated the risks of both in-hospital death and prolonged hospitalizations (> 28 days), considering MAFLD, blood hepatic profile (HP), and FIB-4 score. 49.6% had MAFLD. The accuracy in predicting in-hospital death was 0.709 for the HP alone and 0.721 for HP + FIB-4; in the 55–75 age subgroup, 0.842/0.855; in the MAFLD subgroup, 0.739/ 0.772; in the MAFLD 55–75 years, 0.825/0.833. Similar results were obtained when considering the accuracy in predicting prolonged hospitalization. In our cohort of COVID-19 patients, the presence of a worse HP and a higher FIB-4 correlated with a higher risk of death and prolonged hospitalization, regardless of the presence of MAFLD. These findings could improve the clinical risk stratification of patients diagnosed with SARS-CoV-2 pneumonia.Supplementary InformationThe online version contains supplementary material available at 10.1007/s11739-023-03316-6.