Sunan Abu Dawud #3575
The Office of the Judge (Kitab Al-Aqdiyah) 25:5
Narrated AbuHurayrah:
The Prophet (ﷺ) said: If anyone seeks the office of judge among Muslims till he gets it and his justice prevails over his tyranny, he will go to Paradise; but the man whose tyranny prevails over his justice will go to Hell.