Sayyiduna Abdullah bin Mas’ud (may Allah be pleased with him) narrates that the Messenger of Allah (peace and blessings be upon him) said: Envy (desire to be like someone) is permitted only in two cases. One is the person whom Allah has given wealth, and he has the ability to spend that wealth in the way of truth; and the other is the person whom Allah has granted wisdom (knowledge), and he judges by it and teaches it (to the people).
Hadith Referenceاللؤلؤ والمرجان / كتاب صلاة المسافرين وقصرها / 467
Hadith Gradingمحدثین:«صحیح»
Hadith Takhrij«صحیح، أخرجه البخاري في: 3 كتاب العلم: 15 باب الاغتباط في العلم والحكمة»