The White House and Senate Republican leaders agreed yesterday on a strategy for heading off a presidential veto of the catch-all spending bill that Congress must adopt by the weekend to keep the government from running out of money.

But a Senate leadership source insisted, "We're not out of the woods yet," and House Speaker Thomas P. (Tip) O'Neill Jr. (D-Mass.) asserted that President Reagan really wants to veto the measure "to get a headline" and to win a "personal victory."

Moreover, Senate leaders were still scrambling last night to put together a bill that would be acceptable to both Reagan and a majority of the Senate, and it was not clear whether the result will satisfy the president.

After a day of crosstown negotiations by telephone with White House officials, Senate Majority Leader Howard H. Baker Jr. (R-Tenn.) agreed to push for a cut of about $3.6 billion from the so-called "continuing resolution" in exchange for administration acceptance of a Sept. 30, 1982, termination date for the measure.

A number of senators want the resolution to run through Sept. 30, the end of this fiscal year, to avoid fights over further stopgap legislation.

Although Reagan had wanted a March 30 expiration date, the date never appeared to be a major issue for the White House, and the Senate rejected the March date yesterday by a vote of 51 to 46. But sources said the agreement was enough to win over a sufficient number of reluctant senators to make it worthwhile for Baker to push for the cut on the Senate floor today.

With the agreement, "We feel the votes are there to pass" the cut, said a spokesman for Baker. "Baker would not bring it up if he didn't think it would pass," the spokesman said.

The initial agreement had been for a 5 percent cut, but Senate staff members last night prepared a tentative draft that would impose a cut of only 3.5 percent. Sources said the goal was still to achieve cuts of about $3.6 billion, possibly by including some areas of spending, such as defense, that had not been included in the 5 percent proposal.

Negotiations were continuing last night and a final decision was not expected until a Republican caucus this morning.

Even if the Senate adopts the cut, the big question remains the House, which voted 189 to 201 on Monday against going along with a 5 percent reduction, as proposed by Minority Leader Robert H. Michel (R-Ill.).

Although Michel lost, the vote was apparently close enough, with a large number of absentees, to make it worthwhile to gamble on a reversal or an eventual compromise that would satisfy Reagan.

In a letter to Baker on Tuesday, Reagan indicated he would accept something "similar" to Michel's proposal, even though it would mean giving up more than half the domestic appropriations cuts that he had proposed in September in his latest program for cutting the budget.

Reagan had wanted $8.4 billion in domestic appropriations cuts. According to his Office of Management and Budget, a 5 percent cut from the Senate version of the resolution would yield savings of $3.6 billion.

Whether Reagan would accept anything less, if necessary to win a House-Senate agreement on the measure, was unclear yesterday, although Senate sources said they believed that something less might be acceptable to the White House.

The sources said they hoped to receive some signal from Reagan last night at a dinner he planned to attend with Republican senators at the Library of Congress. A resolution of the dispute over the big spending bill is necessary by the weekend because stopgap funding for most of the government, required because Congress has yet to complete action on any appropriations bills for the executive branch, expires at midnight tomorrow.

This means Congress and Reagan have the weekend to reach agreement or executive branches and agencies will be technically without authority to reopen on Monday except for vital public services. Congress plans to be in session all weekend, if necessary, to resolve the dispute.