What prayer can one do to conquer the frequent bad thought about others?
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.
If the question is about supplications that may help purify one’s heart from grudge and envy toward Muslims, one of these supplications is stated in the saying of Allah, the Almighty (which means): {And [there is a share for] those who come after them, saying, ‘Our Lord, forgive us and our brothers who preceded us in faith and put not in our hearts [any] resentment toward those who have believed. Our Lord, indeed You are Kind and Merciful.} [Quran 59: 10]
Ar-Razi stated in his Tafsir (interpretation of the Quran): “The Arabic word ‘Ghil’ stated in the verse means grudge, envy, and resentment.” It was reported in a Sahih (authentic) Hadith narrated by
At-Tirmithi in his Sunan: “O My Lord, accept my repentance, wash away my sin, answer my supplication, clearly establish my evidence, make true my tongue, guide my heart, and draw out the malice in my breast.” It was stated in “Mir'aat Al-Mafateeh fi Sharh Mishkaat Al-Masabeeh”: “The Arabic word ‘Islul’ with Dammah (an apostrophe-like shape written above the consonant to represent a short vowel “u” (like the "u" in "put") on the letter ‘Lam’ means unsheathe like unsheathing a sword. The Arabic phrase ‘Sakhimat Sadri’ with a Fat’hah (a diagonal stroke written above the consonant to represent a short vowel “a”, like the “a” in English “magic”) on the letter ‘Seen’ and a Kasrah (a diagonal stroke written below the consonant to represent a short vowel “i”, like the "i" in English "pit") under the letter ‘Kha’’ means disloyalty, grudge, and malice. It was also said that the word ‘Sakhimah’ means resentment and is derived from the word ‘Sukhmah’ which means blackness. In addition, “Sukham Al-Qidr” (blackness of a pot) is derived from the same meaning.
This supplication was reported by At-Tirmithi in Ad-Da'awat, Abu Dawood in Awakhir Al-Salah, Ibn Majah in Ad-Du`aa’, Ahmad, Al-Bukhari in Al-Adab Al-Mufrad, An-Nasa’i in Al-Yawm wal Laylah, Ibn Hibban in his Sahih, Al-Hakim, Ibn Abi Shaybah, and Al-Baghawi.” [End quote]
One of the useful supplications that one may say is: “O Allah, purify my heart from any characteristic that does not please You. O Allah, purify my heart from resentment, grudge, envy, and arrogance. O Allah, purify my heart from any evil, harm, and ailment.”
Allah knows best.
You can search for fatwa through many choices