“Garbage,” huffed Sen. John McCain, when the Congressional Budget Office declared that a Republican bid to repeal Obamacare would add to the deficit.

When the agency said President Barack Obama’s stimulus package had saved or created some 3 million jobs, Republicans also scoffed. And when CBO determined that a cap-and-trade plan would not increase energy costs nearly as much as some had warned, House deputy Republican leader Eric Cantor said the agency “has entered the realm of losing its credibility.”

All of that was before a pair of CBO reports landed this month on Congress’s doorstep.

The agency said Obama’s signature health care law would reduce the number of workers by roughly 2 million and, then, two weeks later, predicted Democrats’ proposal to lift the minimum wage would cost a half-million jobs.

Suddenly, Republicans were big CBO fans.

“The nonpartisan Congressional Budget Office confirmed yet again what we know to be true,” said Sen. John Cornyn, the chamber’s second-ranking Republican.

Democrats, who picked the agency’s director, were left to fume about how Congress’s official budget scorekeeper had come up with its numbers.

Everyone loves CBO, except, of course, when they don’t.

Lawmakers hail the agency’s findings when they confirm what they already believe. And when they don’t, politicians in both parties throw up CBO’s hood and try to explain to its platoon of Ph.d’s what exactly it is they’re doing wrong.

That was clear over the past couple weeks, when CBO shot holes in two of Democrats’ biggest election-year priorities.

Republicans, who, over the years, have fought with the agency over everything from marginal tax rates to immigration, were thrilled with its conclusion that Obamacare would shrink the nation’s labor force.

They initially fumbled the findings, saying, wrongly, the showed businesses shedding jobs. That led to a round of news stories debunking their claims, and gave the spotlight to Democrats’ emphasis on those suddenly freed from jobs they only kept for the health insurance. But the report also predicted that, because Obamacare subsidies are tied to income, some people would work less so they don’t earn so much that they disqualify for federal assistance.

CBO’s next report, on the effects of raising the minimum wage to $10.10 from $7.25, gave Republicans ammo in their other major election-year fight, over income inequality, and left Democrats in the odd position of simultaneously loving and hating the agency for the same report.

They liked the parts about a minimum wage lifting some 900,000 out of poverty, and increasing wages for more than 16 million people, including some earning a bit more than the minimum wage.

But the part about job losses?

“A myth,” said Sen. Tom Harkin (D-Iowa).

“Its conclusions contradict the consensus among hundreds of America’s top economists,” said House Minority Leader Nancy Pelosi (D-Calif.).

Rep. Jan Schakowsky (D-Ill.) suggested CBO was merely guessing.

Referring to the economic modelling the agency uses to produce its numbers, she said, “I am surprised and disappointed that the CBO decided to run what it calls a ‘simulation’” instead of “looking at the facts on the ground.” She said, “we don’t have to guess about possible impacts — we have plenty of real-world evidence.”

But weren’t both of those conclusions, about the job losses and the benefits to low earners, based on the same methodology?

“Does raising the minimum wage reduce poverty? There have been a number of studies that have address that question and almost all of them have come to the answer ‘yes.” In that case, CBO is restating a consensus,” said Jason Furman, the chairman of Obama’s Council of Economic Advisers, in a call within hours of the CBO report being released.

“When it comes to employment, I think they are not restating what I would understand the consensus to be — and that’s where I think there’s some respectful disagreement,” he told reporters.

At the center of it all is Doug Elmendorf, the always-measured CBO director who chooses his words with the care of someone who’s routinely asked to predict exactly what might happen many years from now if Congress decides to do one thing or another.

He seems unperturbed by lawmakers’ constantly shifting opinions of his agency.

“We understand that there will be a range of reactions” and “that doesn’t surprise us nor does it have any effect on the work that we do,” Elmendorf said this week at a breakfast with reporters.

He defended the agency’s minimum-wage predictions.

“Some economists undoubtedly will find our estimates of the employment effects to be larger than they would pick themselves, and other economists would find our estimates of the employment effects to be smaller,” he said. “Our job is to provide Congress with a balanced reading, and we’ve done that.”

Elmendorf rejected some Democrats’ suggestions that CBO’s economic skills were getting rusty, saying its analysis is “completely consistent with the latest thinking in the economics profession — we did an exhaustive review of the literature in this area, up through reports that were released last month.”

And he noted that the prominent economists cited by Democrats were not exactly disinterested observers, pointing out that they had signed a letter calling for a minimum wage hike.