كتاب الإيمان
1  
The Book of Faith
(59)
Chapter: If a person thinks of doing a good deed it will be recorded for him, and if he thinks of doing a bad deed it will not be recorded for him
(59)
باب إِذَا هَمَّ الْعَبْدُ بِحَسَنَةٍ كُتِبَتْ وَإِذَا هَمَّ بِسَيِّئَةٍ لَمْ تُكْتَبْ ‏‏
Sahih Muslim 128 a

It is narrated on the authority of Abu Huraira that the Messenger of Allah (ﷺ) said:

The Great and the Glorious Lord said (to angels): Whenever My bondsman intends to corn it an evil, do not record it against him, but if he actually commits it, then write it as one evil. And when he intends to do good but does not do it, then take it down is one act of goodness, but if he does it, then write down ten good deeds (in his record).
حَدَّثَنَا أَبُو بَكْرِ بْنُ أَبِي شَيْبَةَ، وَزُهَيْرُ بْنُ حَرْبٍ، وَإِسْحَاقُ بْنُ إِبْرَاهِيمَ، - وَاللَّفْظُ لأَبِي بَكْرٍ قَالَ إِسْحَاقُ أَخْبَرَنَا سُفْيَانُ، وَقَالَ الآخَرَانِ، حَدَّثَنَا - ابْنُ عُيَيْنَةَ، عَنْ أَبِي الزِّنَادِ، عَنِ الأَعْرَجِ، عَنْ أَبِي هُرَيْرَةَ، قَالَ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏ "‏ قَالَ اللَّهُ عَزَّ وَجَلَّ إِذَا هَمَّ عَبْدِي بِسَيِّئَةٍ فَلاَ تَكْتُبُوهَا عَلَيْهِ فَإِنْ عَمِلَهَا فَاكْتُبُوهَا سَيِّئَةً وَإِذَا هَمَّ بِحَسَنَةٍ فَلَمْ يَعْمَلْهَا فَاكْتُبُوهَا حَسَنَةً فَإِنْ عَمِلَهَا فَاكْتُبُوهَا عَشْرًا ‏"‏ ‏.‏
Reference : Sahih Muslim 128a
In-book reference : Book 1, Hadith 241
USC-MSA web (English) reference : Book 1, Hadith 233
  (deprecated numbering scheme)