Sahih Muslim 816
Narration text is preserved in its supplied Arabic and English. Translated interfaces and reading guides do not add narration translations in other languages.
لاَ حَسَدَ إِلاَّ فِي اثْنَتَيْنِ رَجُلٌ آتَاهُ اللَّهُ مَالاً فَسَلَّطَهُ عَلَى هَلَكَتِهِ فِي الْحَقِّ وَرَجُلٌ آتَاهُ اللَّهُ حِكْمَةً فَهُوَ يَقْضِي بِهَا وَيُعَلِّمُهَا "
Abdullah b. Mas'ud reported Allah's Messenger (ﷺ) as saying:
There should be no envy but only in case of two persons: one having been endowed with wealth and power to spend it in the cause of Truth, and (the other) who has been endowed with wisdom and he decides cases with the help of it and teaches it (to others).
Full reference and source
Sahih Muslim 816 In-book : Book 6, Hadith 324 USC-MSA web (English) : Book 4, Hadith 1779 (deprecated)
View source on Sunnah.com (opens in a new tab)