Bulugh al-Maram, Book 14, Hadith 1 (In-Book)

Narrated Buraida (RA) Allah's Messenger said: "al-Qudat (judges) are of three types, two of whom will go to Hell and one to Paradise. The one who will go to Paradise is a man who knows what is right and gives judgement accordingly. However, a man who knows what is right, and does not give judgement accordingly and acts unjustly in his judgement, will be in the Hell-fire. Likewise, a man who does not know what is right and judges people with ignorance, will be in the Hell-fire." [Reported by al-Arba'a, and al-Hakim graded it Sahih (authentic)].

عَنْ بُرَيْدَةَ ‏- رضى الله عنه ‏- قَالَ: قَالَ رَسُولُ اَللَّهِ ‏- صلى الله عليه وسلم ‏-{ "اَلْقُضَاةُ ثَلَاثَةٌ: اِثْنَانِ فِي اَلنَّارِ, وَوَاحِدٌ فِي اَلْجَنَّةِ.‏ رَجُلٌ عَرَفَ اَلْحَقَّ, فَقَضَى بِهِ, فَهُوَ فِي اَلْجَنَّةِ.‏ وَرَجُلٌ عَرَفَ اَلْحَقَّ, فَلَمْ يَقْضِ بِهِ, وَجَارَ فِي اَلْحُكْمِ, فَهُوَ فِي اَلنَّارِ.‏ وَرَجُلٌ لَمْ يَعْرِفِ اَلْحَقَّ, فَقَضَى لِلنَّاسِ عَلَى جَهْلٍ, فَهُوَ فِي اَلنَّارِ" } رَوَاهُ اَلْأَرْبَعَةُ, وَصَحَّحَهُ اَلْحَاكِمُ 1‏.‏ ‏1 ‏- صحيح.‏ رواه أبو داود ( 3573 )‏، والنسائي في "الكبرى" ( 3 / 461 ‏- 462 )‏، والترمذي ( 1322 )‏، والحاكم ( 4 / 90 )‏ من طريق عبد الله بن بريدة، عن أبيه، به.‏

sunnah.com

also referenced under: Book 14, Hadith 1397 (English)