You can tell how deeply Donald J. Trump cares about a thing by the extent to which he makes up numbers about it: How many stories in Trump Tower; how many viewers for “The Apprentice”; how many people at his inauguration. So it was not exactly stunning when he held a Monday-night rally in El Paso and spun a fanciful overestimate of his attendance that the city’s fire department later shot down.

What was different was that he also came up with some creative stats for someone else’s rally: the former Texas congressman Beto O’Rourke, an El Paso native and a potential Democratic candidate, who spoke at a counterdemonstration against the president’s immigration policies. The president told his faithful that Mr. O’Rourke was speaking to “200 people, 300 people” — though unofficial estimates of the crowd ran well into the thousands.

I will leave it to others to adjudicate whose was bigger. But the night was an example of how nothing threatens this TV president more than a challenge to his ratings.

By holding a rally in Mr. O’Rourke’s home base, the president gave him the chance to do what few political opponents have managed since 2015: to split-screen him.

On cable news and in the morning-after coverage, there was a competing image to Mr. Trump’s MAGA-hatted arena throng: a “Monday Night Lights” assembly of protesters crowding a baseball field as Mr. O’Rourke, gesturing animatedly in shirt sleeves, insisted that the city was “safe not because of walls but in spite of walls.”

Potentially as significant as what Mr. O’Rourke said was that he managed to share billing with the president on TV. He benefited, of course, from Mr. Trump’s serving as his location scout and delivering him a made-for-cable-news opportunity. But his audience was not the only one that the ratings-hound-in-chief has been watching warily.

After Senator Kamala Harris of California began her campaign in front of more than 20,000 people in Oakland, the president mispronounced her name in an interview with The Times but took note of her “better crowd, better enthusiasm.” He was less kind to Senator Elizabeth Warren, mocking a viral Instagram video of her cracking open a beer on New Year’s Eve, and Senator Amy Klobuchar, whom he critiqued for kicking off her campaign outdoors in a Minnesota snowstorm.

I know: It is demeaning and depressing to describe the American electoral process as a TV show. Nonetheless it is also true, as proven by the White House’s current occupant. (And not only by him: It was not for nothing that Republicans anxiously tried to dismiss Barack Obama in 2008 as a “celebrity.”)

And while getting media attention is not the same as making policy, it’s not irrelevant to that, either. Alexandria Ocasio-Cortez has gotten almost-unheard-of political influence for a first-term representative in part by being a media star — which is to say, by personifying a narrative, in TV and social media, of a counter-movement further left, more inclusive and younger than Mr. Trump’s own.

Taking on the president in the media doesn’t have to mean imitating him, down to the insults and the Twitter fights. But it does mean being able to seize attention with an alternative story, and sense what the camera is hungry for. To take down the No. 1 show in the country, you need to be an effective counterprogrammer.

That happens all the time in showbiz. In the president’s protesting-too-much theater criticism of his potential opponents, there’s a hint of the aging celeb’s fear of being overtaken by the next hot sensation — someone dynamic, younger or newer, who will catch and hold the camera’s roving eye. (This may have been the subtext when he told a West Virginia rally that he worries only about “some total unknown.”)

Mr. Trump has become yesterday’s news before. In the 1980s, he was the braggadocious public face of Reagan-era capitalism, dominating tabloid pages and talk shows; by the 1990s, he was a self-parody, doing ironic cameos on sitcoms like “The Fresh Prince of Bel-Air.”

For one season, “The Apprentice” was a pop-culture sensation that made him the toast of a grateful NBC; within years, the ratings dwindling and the public bored of the show’s overexposure, he was hosting a farcical, less-popular “celebrity” version.