Sounds like it could be a bacterial infection and possibly have an underlying allergy.
Speak with your vet about using a using a medicated shampoo such as Pyohex® Shampoo, Conditioner or Barazone® might be right for your dog.
Dermcare Pyohex® Medicated Shampoo is registered pursuant to the ACVM Act 1997, No. A7502. Dermcare Pyohex® Medicated Conditioner is registered pursuant to the ACVM Act 1997, No. A12027. See www.foodsafety.govt.nz for registration conditions.