A judge was a figure of authority, one who interpreted the laws of a culture and often sentenced those who had been found guilty of breaking the laws. Judges usually presided over a court in which they exercised their authority.
The exact role of the judge varied across cultures. In Cardassian society, the role of judge was filled by the Chief Archon. (DS9: "Tribunal") In most Federation societies judges filled important roles throughout history and many judges, such as T'Pau and Aaron Satie, were revered figures in their cultures. (VOY: "Darkling"; TNG: "The Drumhead")
Someone who acted as an arbiter in contests, using their own judgment to subjective qualities to determine the winner, was also called a judge. Emony Dax was a judge in several gymnastics competitions. (DS9: "Trials and Tribble-ations")