It used to treat a certain skin condition (seborrheic dermatitis, a type of dandruff). In this condition, it is believed that a fungus (Malassezia furfur) infects the skin or scalp, resulting in dry, flaky skin (scales) on the scalp, face, ears, chest, or upper back. Ketoconazole is an azole antifungal drug that works by stopping the growth of fungus.