Beautiful question!
Rabbi Yom Tov Lipman, the Tosefot Yom writes a somewhat lengthy introduction to Tractate Avot (Ethics of the Fathers), based on the Rambam, which addresses your question.
I will try to explain one point he makes there to answer. Avot is the final Tractate of Mishna in the Order of Damages. After a number of tractates that teach in detail about damages, punishments and the court system, one might be troubled with the following question: "What right do these judges and wise people have in each generation to mete out such punishments?"
This tractate teaches us that the Sages and Judges in each generation have received the same tradition of Torah law that Moshe received at Sinai. They did not "invent" the laws; rather these laws are from the Torah and have been handed down faithfully from generation to generation as described in the tractate. In addition, these Sages were very moral people who lived by the highest ethical standards, and were therefore fitting to judge others in court in the most just and unbiased manner.
I hope this has been helpful.