كتاب الإيمان
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 b

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

Allah, the Great and Glorious, said: Whenever my bondsman intends to do good, but does not do it, I write one good act for him, but if he puts it into practice I wrote from ten to seven hundred good deeds in favour of him. When he intends to commit an evil, but does not actually do it, do not record it. But if he does it, I write only one evil.
حَدَّثَنَا يَحْيَى بْنُ أَيُّوبَ، وَقُتَيْبَةُ، وَابْنُ، حُجْرٍ قَالُوا حَدَّثَنَا إِسْمَاعِيلُ، - وَهُوَ ابْنُ جَعْفَرٍ - عَنِ الْعَلاَءِ، عَنْ أَبِيهِ، عَنْ أَبِي هُرَيْرَةَ، عَنْ رَسُولِ اللَّهِ صلى الله عليه وسلم قَالَ ‏ "‏ قَالَ اللَّهُ عَزَّ وَجَلَّ إِذَا هَمَّ عَبْدِي بِحَسَنَةٍ وَلَمْ يَعْمَلْهَا كَتَبْتُهَا لَهُ حَسَنَةً فَإِنْ عَمِلَهَا كَتَبْتُهَا عَشْرَ حَسَنَاتٍ إِلَى سَبْعِمِائَةِ ضِعْفٍ وَإِذَا هَمَّ بِسَيِّئَةٍ وَلَمْ يَعْمَلْهَا لَمْ أَكْتُبْهَا عَلَيْهِ فَإِنْ عَمِلَهَا كَتَبْتُهَا سَيِّئَةً وَاحِدَةً ‏"‏ ‏.‏
Reference : Sahih Muslim 128b
In-book reference : Book 1, Hadith 242
USC-MSA web (English) reference : Book 1, Hadith 234
  (deprecated numbering scheme)