Abstract Background Mentha longifolia L. is a perennial plant belonging to the Lamiaceae family that has a wide distribution in the world. M. longifolia has many applications in the food and pharmaceutical industries due to its terpenoid and phenolic compounds. The phytochemical profile and biological activity of plants are affected by their genetics and habitat conditions. In the present study, the content, constituents and antifungal activity of the essential oil extracted from 20 accessions of M. longifolia collected from different regions of Iran and Iraq countries were evaluated. Results The essential oil content of the accessions varied between 1.54±0.09% (in the Divandarreh accession) to 5.49±0.12% (in the Khabat accession). Twenty-seven compounds were identified in the essential oils of the studied accessions, which accounted for 85.5-99.61% of the essential oil. The type and amount of dominant compounds in the essential oil were different depending on the accession. Cluster analysis of accessions based on essential oil compounds grouped them into three clusters. The first cluster included Baziyan, Boukan, Sarouchavah, Taghtagh, Darbandikhan, Isiveh and Harir. The second cluster included Khabat, Kounamasi, Soni and Mahabad, and other accessions were included in the third cluster. Significant correlations were observed between the essential oil content and components with the climatic and soil conditions of the habitats. The M. longifolia essential oil indicated antifungal activity against Fusarium solani in both methods used. In all studied accessions, the fumigation method compared to the contact method was more able to control mycelia growth. In both methods, the inhibition percentage of essential oil on mycelia growth increased with an increase in essential oil concentration. Significant correlations were found between the essential oil components and the inhibition percentage of mycelium growth. Conclusion The studied M. longifolia accessions showed sign