The Rambam first states that we are only permitted to appoint a judge that has the following qualities:
א אין מעמידין בסנהדרין, בין בגדולה בין בקטנה--אלא אנשים חכמים
ונבונים, מופלאין בחכמת התורה, בעלי דעה מרובה, ויודעין קצת משאר חכמות,
כגון רפואות, וחשבון תקופות ומזלות, ואיצטגנינות, ודרכי המעוננים
והקוסמים והמכשפים והבלי עבודה זרה וכיוצא באלו, כדי שיהיו יודעין לדון
We appoint to a Sanhedrin - both to the Supreme Sanhedrin and to a minor Sanhedrin - only men of wisdom and understanding, of unique
distinction in their knowledge of the Torah and who possess a broad
Which is to say that wisdom and understanding are mandatory prerequisites for appointment to the position without which appointment is altogether improper.
He later states:
וצריך להשתדל ולבדוק ולחפש שיהיו כולן בעלי שיבה, בעלי קומה, בעלי מראה,
נבוני לחש, ושיהיו יודעין ברוב הלשונות כדי שלא תהיה סנהדרין שומעת מפי
An effort should be made that they all be white-haired, of impressive height, of dignified appearance, men who understand whispered matters,
who understand many different languages so that the Sanhedrin will not
need to hear testimony from an interpreter.
These qualities, concerning appearances and knowledge of many languages, ought be searched for ("an effort should be made"), but if they are found to be lacking are not preventative of appointment to the position. They are ab initio preferences, but ultimately not mandatory. The Kesef Mishneh and Lehem Mishneh confirm this reading (משמע דהנהו לא הוו לעיכובא אלא לכתחלה צריך לבדוק אחר אלו)
The mandatory qualities of paramount value are and remain the individual's wisdom and understanding, not their appearance.
If your question, concerns why appearance ought factor in at all - even ab initio, consider the fact that for various reasons (psychological, evolutionary, conditioning, etc.), people are programmed to trust and listen to attractive people more than unattractive people (as is confirmed in many studies). Given that this is so, it would make sense to attempt to appoint justices to whom we are instinctually disposed towards. When not just their wisdom and understanding appeals to people but the entirety of their persona draws people to heed their decisions.
Armed with this understanding, we see that it is not that we are placing aesthetics on a pedestal, but rather it is an attempt to speak to and exploit the natural human condition, in order to effectuate the needs of justice. A handsome judge is preferred (though not mandatory) because quite simply, people are more likely to heed his directives and it thus makes him more effective at his job, which is to effectuate changes in human behavior.