Although I have never dealt with this situation personally before, I suspect that what you are encountering is actually a case where the dog has low immunity.
Therefore, feeding a wholesome and natural raw meat diet will not only help the dog gain weight but will boost its immunity.
Additionally, I would buy some Neem Oil and some Neem Shampoo. I would mix the neem oil in with the shampoo and then use that to wash the dog. Neem is well known for getting rid of skin problems like this including, but not limited to, lice.
Ultimately neem has many uses and can treat all different types of skin problems.
Neem is an Ayurvedic herb meaning it is used in the herbal medicine originating from India.
You can find neem products in many places online or in stores. This is the route I would go. I am sure you will find that a stronger immune system combined with the neem products will make a difference.
Once the body builds its immune system then you will find that the chance of this problem happening again in the future is lower. The best way to boost the immune system is by feeding a natural raw meat diet. If the immune system is not boosted, then the chance of this problem repeating again in the future is there.