All perfect praise be to Allah, The Lord of the worlds. I testify that there is none worthy of worship except Allah and that Muhammad is His slave and Messenger.
It was reported from the Prophet that it is forbidden to curse fever. Abu Hurayrah, may Allah be pleased with him, narrated that fever was mentioned in the presence of the Prophet and one man cursed it, so the Prophet said, “Do not curse fever. Verily, it removes the sins just as fire removes impurities from iron.” [Ahmad and Ibn Maajah]
The meaning of cursing the fever is to give it a bad description or the like of what is known from the meaning of cursing or insulting in general. As regards asking Allah to take it away or seeking refuge with Him from it, then this does not come under the meaning of cursing, so there is nothing wrong in it.
Imaam Ibn al-Qayyim said, “Fever is useful for the body and the heart, and since this is the case, insulting it is injustice and transgression.” [Zaad Al-Ma'aad]
Allah knows best.