After a six-week drumroll while the administration put together its budget and a week of bugled charges from liberals protesting deep cuts in their favorite programs, the battle of the budget finally was joined last week.

And, while White House officials say they survived the initial skirmishes with scarcely a scratch, the week may go down in the record as the first time the new administration didn't have everything its own way.

The president's week got off to a rocky start when the Congressional Budget Office challenged his economic assumptions and predicted federal spending would be $25 billion above the level Reagan assumes next year.

Then the House Education and Labor Committee, with liberal Democrats voting as a bloc, rejected almost $14 billion of Reagan-proposed budget cuts in a wide range of programs.

But if the week began with some rough patches from the president's perspective, it ended with two victories in key congressional committees.

One White House official called it the week of counterattack, but added, "in large-scale counterattack there is emancipation." By his reckoning, if every interest group applies pressure from every direction, the pressures cancel each other and a member of Congress' safest choice is to vote with the president.

Of the liberals' anguished cries, another presidential assistant said: "It didn't surprise us that this chorus started up and, of course, we knew that The Washington Post was going to pay a lot of attention to these people. This is all pretty inevitable."

"I don't think there's been a lot of political damage. I think we're going to win on most of our spending cuts in both houses," said White House chief of staff James A. Baker III.

The House Ways and Means Committee gave Reagan an important victory when it agreed to use his forecasts rather than the Congressional Budget Committee's for its legislative work. The Senate Budget Committee pleased the administration planners by voting $2.3 billion more in spending reductions than Reagan had requested.

"We couldn't have been more successful if we had written the script ourselves," a senior White House official said of the Senate committee's action.

In fact, Reagan and his advisers have spent a lot of time seeking to write the script. One of the stage directions for that script last week was to lie low and let opponents use up ammunition. "We don't have to match them arrow for arrow at this stage," White House press secretary James S. Brady said.

But Reagan's first instinct was to fire back. He labeled the CBO forecasts "phony." Later, after consulting his top advisers, the president decided to be more conciliatory. He said he had chosen the wrong word. What he meant was that the numbers contradicting his were incorrect.

On the negative side last week, the administration was alarmed by the activities of the Coalition for a New Beginning, in whose name some of Reagan's oldest friends were raising funds in an independent effort to sell the Reagan economic program to the people. White House officials passed the word to kill off the coalition.

Also, at midweek a new Gallup poll was published that time could prove the most significant story of the week. The poll showed Reagan's favorable rating had increased since the end of January from 51 to 59 percent, but that his unfavorable rating was at 24 percent, while other recently elected presidents had unfavorable ratings of 9 percent or less two months into their administrations.

Reagan's advisers said the poll was not bad news. Baker said the other presidents "had not bitten the bullet as his president has two months into his term." The economic program, Baker said, had polarized opinion.

In the last week, a good deal of the criticism of Reagan centered around one basic theme -- that his programs are heartlessly designed and will injure the poor while helping the rich.

In a dozen different forms, questioners on Capitol Hill, in the media and in private organizations raised objections based on perceptions that the program is not fair and that the administration's definition of the "truly needy" whom government must continue to help is too exclusive.

"We can withstand that stuff as long as it is argued in terms of poor and middle class and rich," a presidential adviser said. "See, the middle class is the big political bloc and the middle class agrees with Reagan that there is too much money and too much waste in all these programs for poverty. So you don't have any problem if the argument is we haven't done enough for the poor. But if it becomes that we're racist, that's when you have to start answering back. People are not going to support something that is called racist by a lot of people."

Another White House official said the administration is containing criticism of its attitude toward the poor pretty well. He pointed to Sen. Howard M. Metzenbaum (D-Ohio), who last week went on television to attack the administration for cutting holes in its self-labeled "social safety net" -- then voted for the cuts in the Budget Committee.

A lot of screams of pain, according to the official, are coming from those who have alternatives.

He outlines the hypothetical case of a man laid off as an electrician who collects unemployment and refuses to take an available job as a janitor. Under Reagan's proposals, he would be forced to take the janitorial job much sooner. "This guy would scream that we are balancing the budget on the backs of the poor," the adviser said. "People are used to getting a lot of stuff from the federal government."

Reagan took cheer from letters like one Republican Whip Rep. Robert H. Michel (Ill.) showed him from an unemployed factory worker in Peoria.

The man said he had watched Reagan present his economic package Feb. 18 and is willing to have his unemployment benefits cut off to help the economy.

"When the Democrats start lobbying against the new economic plan, let them know that there is someone out here who has seen what they can do and is willing to stake his future on trying a different approach," Michel's constituent wrote in words that could not have been better chosen by White House scriptwriters.

The White House strategy points toward applying maximum pressure for the Reagan tax and spending programs in July and August, timed to the votes in Congress. "A pressure campaign cannot be maintained over the legislative long haul," press secretary Brady said.

So the president was less visible, by design, last week than he has been recently. The only interview he gave was to a Chicago baseball announcer for broadcast during the Cub's opening day game. (Reagan broadcast Cubs games before becoming an actor.)

"We ought not to run the risk of overexposing the president on national TV," a senior adviser said. "We have to husband that resource. It's the most valuable resource we have.