Burayda reported,

The Messenger of Allah ﷺ said, "Judges are of three kinds. Two are in the Fire and one is in Paradise. A man who knew the truth and judged by it is in Paradise. A man who judged among people in ignorance is in the Fire. And a man who acted unjustly in his judgment is in the Fire."We would say that when a judge exercises his utmost effort in reaching a ruling, he is in Paradise.

Ibn Majah 2315

Daif

حدثنا إسمعيل بن توبة حدثنا خلف بن خليفة حدثنا أبو هاشم قال لولا حديث

ابن بريدة عن أبيه

عن رسول الله ﷺ قال القضاة ثلاثة اثنان في النار وواحد في الجنة رجل علم الحق فقضى به فهو في الجنة ورجل قضى للناس على جهل فهو في النار ورجل جار في الحكم فهو في النار لقلنا إن القاضي إذا اجتهد فهو في الجنة

ابن ماجه 2315ضعيف
Contents
Reference
Commentary
Ayat
Collection
Sunan Ibn Majah
Book
Rulings
Chapter
Judge strives and arrives at the truth
Numbering
Darussalam 2315
Ibn Majah 2315