The prohibition of using Khamr as a remedy; It is not a remedy Sahih Muslim 1984

Show Arabic text
Translation
Wa'il al-Hadrami reported that Tariq b. Suwaid a-Ju'fi asked Allah's Apostle (ﷺ) about liquor. He forbade (its use) and he expressed hatred that it should be prepared. He (Tariq) said

I prepare it as a medicine, whereupon he (the Holy Prophet) said: It is no medicine, but an ailment.