Abdullah bin Masud reported,

The Messenger of Allah ﷺ said, "There is no envy except in two cases. A man whom Allah has given wealth and empowered him to spend it in the cause of truth, and another whom Allah has given wisdom by which he judges and which he teaches to others."

Azami 6709

Sahih

عن ابن مسعود قال

قال رسول الله ﷺ: لا حسد إلا في اثنتين: رجل آتاه الله مالا، فسلطه على هلكته في الحق، وآخر آتاه الله حكمة فهو يقضي بها ويعلمها.

الأعظمي 6709صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Judgeship
Chapter
Conduct of the judge
Section
Virtue of one who was given wisdom and judged by it
Numbering
Jami al-Kamil 6709 (2nd edition)
Azami 6709