In 2011, U.S. District Judge Richard J. Leon nearly torpedoed a settlement between the Justice Department and Comcast Corp. over the company’s takeover of NBCUniversal.

Six years later, Judge Leon is set to play a starring role in a higher-stakes sequel: AT&T Inc.’s proposed merger with Time Warner Inc. Last week, the Trump administration’s lawsuit seeking to block the deal was assigned to the blunt-spoken and unpredictable bowtied-clad jurist.

If...