Abu Hurairah reported,

The Messenger of Allah ﷺ said, "The angels say, 'Lord, that servant of Yours intends to commit a sin,' though He sees him better than they do. He says, 'Watch him. If he does it, record it against him as it is, but if he abandons it, record it for him as a good deed, for he abandoned it only for My sake.'"

Azami 15084

Sahih

عن أبي هريرة قال

قال رسول الله ﷺ: قالت الملائكة: رب ذاك عبدك يريد أن يعمل سيئة (وهو أبصر به) فقال: ارقبوه، فإن عملها فاكتبوها له بمثلها، وإن تركها فاكتبوها له حسنة، إنما تركها من جرائي.

الأعظمي 15084صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Asceticism and softening of the heart
Chapter
Virtue of asceticism and softening of hearts
Section
If a servant intends a good deed it is recorded, and if he intends a bad deed it is not recorded
Numbering
Jami al-Kamil 15084 (2nd edition)
Azami 15084