usually secondary to chronic moisture, like playing with or in water.
Can usually treat with an antifungal, like clotrimazole. However, you should really get a vet to look in there with a scope and be sure there are no foreign objects or debris or food allergies as an underlying problem.
Probably not a good idea to start treating without looking in there first, as some remedies will actually make the problem worse, much worse, like a ruptured drum and a middle or inner ear infection, which you really do not want your dog to have.
Good answer.