Sayyiduna Abu Huraira (may Allah be pleased with him) narrated that it was asked: O Messenger of Allah! Who is the most noble? He replied: "The one who is the most pious." It was said: We are not asking about this. He said: "Then Allah's Prophet Yusuf, son of Allah's Prophet, son of Allah's Prophet, son of Allah's Khalil (is the most noble)." The companions said: We are not asking about this either. The Messenger of Allah (peace and blessings be upon him) said: "Alright, are you asking about the families of the Arabs? Listen, those who were noble in the time of ignorance are also noble in Islam, provided they gain understanding of the religion."
Related hadith on this topic