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:5:93

There is not upon those who believe and do righteousness ˹any˺ blame concerning what they have eaten ˹in the past˺ if they ˹now˺ fear Allah and believe and do righteous deeds, and then fear Allah and believe, and then fear Allah and do good; and Allah loves the doers of good.  

Those who believe and perform righteous deeds are not at fault in what they may have consumed, of wine and ˹indulged in˺ of gambling before the prohibition, so long as they fear, the forbidden things, and believed and performed righteous deeds, and then were God-fearing and believed, ˹and then˺ adhered to fear of God and belief, and then were God-fearing and virtuous, in deeds; God loves the virtuous, meaning that He will reward them.
القرآن:٥:٩٣

لَيْسَ عَلَى الَّذِينَ آمَنُوا وَعَمِلُوا الصَّالِحَاتِ جُنَاحٌ فِيمَا طَعِمُوا إِذَا مَا اتَّقَوْا وَآمَنُوا وَعَمِلُوا الصَّالِحَاتِ ثُمَّ اتَّقَوْا وَآمَنُوا ثُمَّ اتَّقَوْا وَأَحْسَنُوا ۗ وَاللَّهُ يُحِبُّ الْمُحْسِنِينَ  

{ليس على الذين آمنوا وعملوا الصالحات جناح فيما طعموا} أكلوا من الخمر والميسر قبل التحريم {إذا ما اتقوا} المحرمات {وآمنوا وعملوا الصالحات ثم اتقوا وآمنوا} ثبتوا على التقوى والإيمان {ثم اتقوا وأحسنوا} العمل {والله يحب المحسنين} بمعني أنه يثيبهم.

See similar narrations below:

Collected by Tirmidhī, Nasāʾī's Kubrá
tirmidhi:3053Sufyān b. Wakīʿ > Khālid b. Makhlad > ʿAlī b. Mushir > al-Aʿmash > Ibrāhīm > ʿAlqamah > ʿAbdullāh

"When (the following) was revealed: Those who believe and do righteous good deeds, there is no sin on them for what they ate, if they have Taqwa and perform good (5:93). The Messenger of Allah ﷺ said to me: 'You are among them.'"  

الترمذي:٣٠٥٣حَدَّثَنَا سُفْيَانُ بْنُ وَكِيعٍ حَدَّثَنَا خَالِدُ بْنُ مَخْلَدٍ عَنْ عَلِيِّ بْنِ مُسْهِرٍ عَنِ الأَعْمَشِ عَنْ إِبْرَاهِيمَ عَنْ عَلْقَمَةَ عَنْ عَبْدِ اللَّهِ قَالَ

لَمَّا نَزَلَتْْ ( لَيْسَ عَلَى الَّذِينَ آمَنُوا وَعَمِلُوا الصَّالِحَاتِ جُنَاحٌ فِيمَا طَعِمُوا إِذَا مَا اتَّقَوْا وَآمَنُوا وَعَمِلُوا الصَّالِحَاتِ ) قَالَ لِي رَسُولُ اللَّهِ ﷺ أَنْتَ مِنْهُمْ قَالَ هَذَا حَدِيثٌ حَسَنٌ صَحِيحٌ  

قَوْلُهُ تَعَالَى: {لَيْسَ عَلَى الَّذِينَ آمَنُوا وَعَمِلُوا الصَّالِحَاتِ جُنَاحٌ فِيمَا طَعِمُوا} [المائدة: 93]

nasai-kubra:11088Aḥmad b. ʿUthmān b. Ḥakīm > Khālid b. Makhlad > ʿAlī b. Mushir > al-Aʿmash > Ibrāhīm > ʿAlqamah > ʿAbdullāh

"When (the following) was revealed: Those who believe and do righteous good deeds, there is no sin on them for what they ate, if they have Taqwa and perform good (5:93). The Messenger of Allah ﷺ said to me: 'You are among them.'" (Using translation from Tirmidhī 3053)   

الكبرى للنسائي:١١٠٨٨أَخْبَرَنَا أَحْمَدُ بْنُ عُثْمَانَ بْنِ حَكِيمٍ حَدَّثَنَا خَالِدُ بْنُ مَخْلَدٍ حَدَّثَنَا عَلِيُّ بْنُ مُسْهِرٍ عَنِ الْأَعْمَشِ عَنْ إِبْرَاهِيمَ عَنْ عَلْقَمَةَ عَنْ عَبْدِ اللهِ قَالَ

لَمَّا نَزَلَتْ {لَيْسَ عَلَى الَّذِينَ آمَنُوا وَعَمِلُوا الصَّالِحَاتِ جُنَاحٌ فِيمَا طَعِمُوا إِذَا مَا اتَّقَوْا وَآمَنُوا وَعَمِلُوا الصَّالِحَاتِ ثُمَّ اتَّقَوْا وَآمَنُوا} [المائدة 93] قَالَ رَسُولُ اللهِ ﷺ «إِنَّهُ مِنْهُمْ»