Negative commandment · Lo Ta’aseh #284 of 613
Not to appoint as a judge a man who is unlearned in the Torah, even if he is learned in other disciplines
שלא למנות בדיינין אדם שאינו חכם בדברי תורה, אף על פי שהוא חכם בחכמות אחרות
The verse · Devarim 1:17
לֹא־תַכִּירוּ פָנִים בַּמִּשְׁפָּט כַּקָּטֹן כַּגָּדֹל תִּשְׁמָעוּן לֹא תָגוּרוּ מִפְּנֵי־אִישׁ כִּי הַמִּשְׁפָּט לֵאלֹהִים הוּא וְהַדָּבָר אֲשֶׁר יִקְשֶׁה מִכֶּם תַּקְרִבוּן אֵלַי וּשְׁמַעְתִּיו
“Do not respect persons in judgment; but hear the small as well as the great; do not be afraid of the face of any man; for the judgment is God’s: and the cause that is too hard for you, bring it to me, and I will hear it.”
The Rambam’s words
Not to appoint as a judge a man who is unlearned in the Torah, even if he is learned in other disciplines, as [Deuteronomy 1:17] states: "Do not show favoritism regarding judgment."
שלא למנות בדיינין אדם שאינו חכם בדברי תורה, אף על פי שהוא חכם בחכמות אחרות, שנאמר "לֹא תַכִּירוּ פָּנִים בַּמִּשְׁפָּט" (דברים א, יז).
Why · Sefer HaChinuch #414
Not to appoint a judge that does not know the laws of the Torah
“The root of this commandment is revealed to all.”
Who & when
“And this commandment is practiced in every place and at all times.”
Where in the Mishneh Torah
Hilchot The Sanhedrin and the Penalties within Their Jurisdiction הלכות סנהדרין והעונשין המסורין להם