The ahaadith are apparently contradictory in this regard. Whilst some sahabah have reported the usage of dye, others have denied it.
The narrations reported by Abu Rimthah and Abdullah ibn Umar (Allah be pleased with them) assert that the Prophet (Allah bless him and give him peace) did in fact use dye. On the contrary, Anas (Allah be pleased with him) negates the fact that the Prophet (Allah bless him and give him peace) used dye. Imam Malik and Qadhi Ayaadh (Allah have mercy on them) opine that the narration of Anas (Allah be pleased with him) is accurate, and they reconcile the ahaadith with the following approach:
1) Traces of colour would remain in the hair of the prophet (allah bless him and give him peace) as a result of using a shampoo in the form of saffron and waras leaves.
2) Another response is that the change of colour was not due to the usage of dye, rather it was due to applying oil and perfume excessively to the hair.
3) A third interpretation is that many people saw the cut hair of the Prophet after his demise. Cut off hair has a tendency to change colour after a while. (Fathul Bari 10/354, Umdatul Qari, Jam’ul wasaa’il page 101)
Other scholars are of the view that the people who secured strands from the hair of the Prophet (Allah bless him and give him peace), dyed these strands after his demise. (Jam’ul wasaa’il page 101) (ash-shamaa’il al-kubra 2/93)
Some scholars believe that the Prophet (Allah bless him and give him peace) applied henna to the head due to headaches. So the application of dye was merely for medical purposes and not for any other motive. (Jam’ul wasaa’il page 101) (ash-shamaa’il al-kubra 2/93)
Another logical explanation is provided by Ibn Rasalaan (Allah have mercy on him), who harmonised the contradictory ahaadith; the negating hadith of Anas and the affirming hadith of Abu Rimtha. Ibn Rasalaan was of the view that the hadith of Anas denotes that the Prophet (Allah bless him and give him peace) didn’t dye his hands or feet, where as the hadith of Abu Rimtha radiallahu anhu means that the Prophet salallahu alaihi wasallam dyed his hair and beard. (Bazlul majhood 17/95)
The preferred view
Imam Nawawi has written that the preferred view is that the Prophet (Allah bless him and give him peace) did apply dye, but this was not done on a regular basis. Ibn Hajar al-Asqalaani endorses the opinion of Imam Nawawi that the prophet (Allah bless him and give him peace) used dye occasionally. This seems to be the best view, as it is difficult to negate all the supporting ahaadith. (ash-shamaa’il al-kubra 2/93)
This answer was collected from DarulFiqh.com, which is operated under the supervision of Mufti Faraz ibn Adam al-Mahmudi, the student of world renowned Mufti Ebrahim Desai (Hafizahullah).