I asked Anas bin Malik, "Did the Messenger of Allah ﷺ dye his hair?"He replied, "He had not reached the point of dyeing. There were only a few white hairs in his beard."I then asked him, "Did Abu Bakr dye his hair?"He answered, "Yes, with henna and katam."
سألت أنس بن مالك هل كان رسول الله ﷺ خضب؟ فقال: لم يبلغ الخضاب، كان في لحيته شعرات بيض. قال قلت له: أكان أبو بكر يخضب؟ قال: فقال: نعم بالحناء والكتم.
Muslim narrated it in the Book of Virtues (2341:101), from Muhammad bin Bakkar bin Rayyan, who said, Ismail bin Zakariya told us, from Asim Ahwal, from Ibn Sirin, and he related it.Anas's denial indicates either his lack of knowledge of it, or that it was minimal, or that it varied at different times ﷺ, for sometimes he would dye it and sometimes leave it. The hadith of Ibn Umar, that he saw the Prophet ﷺ dyeing with yellow, and the hadith of Umm Salama, "I saw a few red hairs," take precedence over the hadith of Anas. As for the differing reports about the extent of his gray hair, the sahih view is that it was something slight, so whoever denied it meant that it was not extensive.For more, see the Book of Sirah.