DDX58, IFIT2, IFIH1, RSAD2, IFI44L, OAS2, OAS1, OASL, IFIT1, IFIT3, MX1, STAT1, and ISG15 were hub genes in TB, and the diagnostic model based on eight immune-related key genes exhibited good diagnostic performance. Here, OASL is linked to tuberculosis.