Double Entendre: ambiguity of meaning arising from language that lends itself to more than one interpretation. (Google)
Sober adjective
1: sparing in the use of food and drink: abstemious.
2: marked by sedate or gravely or earnestly thoughtful character or demeanor.
(Merriam-Webster online)
Sober: etymology: mid-14c., "moderate in desires or actions, temperate, restrained," especially "abstaining from strong drink," also "calm, quiet, not overcome by emotion," from Old French sobre "decent; sober" (12c.), from Latin sobrius "not drunk, temperate, moderate, sensible," from a variant of se- "without" (see se-) + ebrius "drunk," of unknown origin. Meaning "not drunk at the moment" is from late 14c.; also "appropriately solemn, serious, not giddy." Related: Soberly; soberness. Sobersides "sedate, serious-minded person" is recorded from 1705. (etymonline)
The adjective sober has several distinct meanings, two of which are in play here.
Sober as a Judge idiom / simile
1. Cliché very formal, somber, or stuffy. (*Also: as ~.) You certainly look gloomy, Bill. You're sober as a judge. Tom's as sober as a judge. I think he's angry.
2. Cliché not drunk; alert and completely sober. (*Also: as ~.) John's drunk? No, he's as sober as a judge. You should be sober as a judge when you drive a car. (The Free Dictionary)
So, within this rather clever turn of phrase I can see two double entendres operating - one based on the two distinct senses of the term "sober," and the other utilizing the fixed phrase "sober as a judge," to mean both 1) “sober as a judge” which plays upon the reputation – deserved or not – for the propriety of judges (serious, grave, solemn, sedate, staid, earnest), and 2) a literal, rather than figurative, take on the simile, i.e., "I'm happy to see you are abstemious when acting in the official capacity as a judge."