Background The diagnosis of superficial fungal infections is still mostly based on direct microscopic examination with potassium hydroxide solution. However, this method can be time consuming, and its diagnostic accuracy rates vary widely depending on the clinician's experience. Objectives This study presents a deep neural network structure that enables the rapid solutions for these problems and can perform automatic fungi detection in grayscale images without dyes. Methods One hundred sixty microscopic full field photographs containing the fungal element, obtained from patients with onychomycosis, and 297 microscopic full field photographs containing dissolved keratin obtained from normal nails were collected. Smaller patches containing fungi (n = 1835) and keratin (n = 5238) were extracted from these full field images. In order to detect fungus and keratin, VGG16 and InceptionV3 models were developed by the use of these patches. The diagnostic performance of models was compared with 16 dermatologists by using 200 test patches. Results For the VGG16 model, the InceptionV3 model and 16 dermatologists, mean accuracy rates were 88.10 +/- 0.8%, 88.78 +/- 0.35% and 74.53 +/- 8.57%, respectively; mean sensitivity rates were 75.04 +/- 2.73%, 74.93 +/- 4.52% and 74.81 +/- 19.51%, respectively; and mean specificity rates were 92.67 +/- 1.17%, 93.78 +/- 1.74% and 74.25 +/- 18.03%, respectively. The models were statistically superior to dermatologists according to rates of accuracy and specificity but not to sensitivity (p < .0001, p < .005 and p > .05, respectively). Area under curve values of the VGG16 and InceptionV3 models were 0.9339 and 0.9292, respectively. Conclusion Our research demonstrates that it is possible to build an automated system capable of detecting fungi present in microscopic images employing the proposed deep learning models. It has great potential for fungal detection applications based on AI.