Economically and agriculturally important fungal species have various lifestyles, and they may shift from mutualistic or saprobic to pathogenic depending on the habitat, host tolerance, and resource availability. Traditionally, the determination of fungal lifestyles has been based on observation at a particular host or habitat. Therefore, potential fungal pathogens have been neglected until they cause devastating impacts on human health, food security, and ecosystem stability. This study focused on the class Sordariomycetes to explore the genomic traits that could be used to determine the lifestyles of fungi and the possibility of predicting fungal lifestyles using machine learning algorithms. A total of 638 representative genomes covering five subclasses, 17 orders and 50 families were selected and annotated. Through an extensive literature survey, the lifestyles of 555 genomes were determined, including plant pathogens, saprotrophs, entomopathogens, mycoparasites, endophytes, human pathogens and nematophagous fungi. We evaluated the influence of sequencing technologies and concluded that second sequencing technologies have no influence on genome completeness but tend to generate a reduced size of transposable elements. We constructed three numerical matrices: a basic genomic feature matrix including 25 features; a functional protein matrix including 24 features; and a combined matrix. The most comprehensively comparative analysis to date across multiple lifestyles was conducted based on these matrices. Results indicate that basic genomic features reflect more on phylogeny rather than lifestyle, but the abundance of functional proteins displays relatively high discrimination not only in differentiating taxonomic groups at the higher levels but also in differentiating lifestyles. Genome size, GC content and gene number showed powerful discrimination for differentiating higher ranks, especially at the subclass level. Plant pathogens have the largest secretome; whereas entomopathogens have the smallest secretome; and the abundance of secretomes is a useful indicator to clearly differentiate plant pathogens from entomopathogens, mycoparasites, saprotrophs and entomopathogens, and as well as differentiate entophytes from entomopathogens. Effectors have long been considered as disease determinants, and we did observe that plant pathogens have more effectors than saprotrophs and entomopathogens. However, we also observed a similar abundance of effectors in endophytes, suggesting that effectors maybe not a reliable indicator for pathogenic fungi. Single functional protein could not differentiate all lifestyles, but combinations of multiple numerical features of functional proteins result in accurate differentiation for most lifestyles. Furthermore, models of six machine learning algorithms were trained, optimized and evaluated, and the best-performance model was used to predict the lifestyle of 83 unlabeled genomes. Although the accuracy of the best machine learning model was limited by the inadequate genome number of several lifestyles and the inaccurate lifestyle assignments for some genomes, the predictive model still obtained a high degree of accuracy in differentiating plant pathogens. The predictive model can be further optimized with more sequenced genomes in the future, and provide a more reliable prediction. This can be used as an early warning system to identify potentially devastating fungi and take appropriate measures to prevent their spread.