Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:35:8

Then is one to whom the evil of his deed has been made attractive so he considers it good ˹like one rightly guided˺? For indeed, Allah sends astray whom He wills and guides whom He wills. So do not let yourself perish over them in regret. Indeed, Allah is Knowing of what they do.  

The following was revealed regarding Abū Jahl and others: Is he, the evil of whose deeds is made ˹to seem˺ fair to him, by distortion, so that he deems it good ˹…˺? (a-fa-man, ‘is he ˹whose˺’ constitutes the subject, the predicate of which is ˹an omitted˺ ‘like one whom God has guided?’ No! And this ˹predicate˺ is indicated by ˹what follows˺). Indeed God leads astray whomever He will and guides whomever He will. So do not let your soul expire for their sake, for those to whom it has made ˹to seem˺ fair, out of sighings, by becoming anguished lest they do not believe. Indeed God is Knower of what they do, and He will requite them for it.
القرآن:٣٥:٨

أَفَمَنْ زُيِّنَ لَهُ سُوءُ عَمَلِهِ فَرَآهُ حَسَنًا ۖ فَإِنَّ اللَّهَ يُضِلُّ مَنْ يَشَاءُ وَيَهْدِي مَنْ يَشَاءُ ۖ فَلَا تَذْهَبْ نَفْسُكَ عَلَيْهِمْ حَسَرَاتٍ ۚ إِنَّ اللَّهَ عَلِيمٌ بِمَا يَصْنَعُونَ  

ونزل في أبي جهل وغيره {أفمن زينَ له سوء عمله} بالتمويه {فرآه حسنا} من مبتدأ خبره كمن هداه الله؟ لا، دل عليه {فإن الله يضل من يشاء ويهدي من يشاء فلا تذهب نفسك عليهم} على المزيَّن لهم {حسرات} باغتمامك ألا يؤمنوا {إن الله عليم بما يصنعون} فيجازيهم عليه.