Democratic leaders of the House and Senate finally resolved their budget differences yesterday, agreeing on a $1 trillion spending plan for fiscal 1988 that propels them toward a confrontation with the Reagan administration over higher taxes and spending priorities.

The accord came after more than five weeks of seesaw negotiations that grew increasingly urgent this week when President Reagan castigated Congress for "caving in to its old tax-and-spend addictions." Faced with the president's offensive, Democratic leaders feared that a continued party deadlock on the budget would cost them their legislative momentum just a few months after recapturing control of Congress.

The budget agreement, which will reach the full House and Senate next week, broke a prolonged deadlock over defense spending in which the Senate pressed for outlays higher than the more liberal House desires.

The spending plan, expected to pass both houses, calls for $65 billion over three years in tax increases, their precise nature to be determined by separate legislation.

Military spending authority for the fiscal year that begins in October would be set at $296 billion but would fall to $289 billion if Reagan does not sign separate legislation raising taxes by $19.3 billion in the first year.

If the president does not accept the tax increase -- which he has repeatedly vowed to veto -- the Defense Department would get only $2 billion more than it is receiving this year, and a total of $23 billion less in spending authority than it requested in January.

House Budget Committee Chairman William H. Gray III (D-Pa.) said the linkage between higher taxes and defense spending, pushed by the Senate, means that "the decision whether to have a higher level of military spending is up to the president."

The level of Pentagon spending authority is about $6 billion less than the budget adopted by the Senate in May, and about $7 billion higher than the House version. However, in terms of expenditures during fiscal 1988, as opposed to what is authorized for that and future years, the Pentagon budget would be only $1 billion less than the budget adopted by the Senate and $8 billion higher than the House version.

The agreement would cut domestic spending by $11 billion below the level that would occur with normal inflationary growth.

Those cuts, combined with the tax increase and a $7 billion saving from refinancing rural electrification loans, would result in a total reduction of $37 billion in the federal budget deficit, leaving a fiscal 1988 deficit of between $130 billion and $135 billion. That is well short of the $108 billion goal set by the 1985 Gramm-Rudman-Hollings budget law.

Senate Majority Leader Robert C. Byrd (D-W.Va.) declared: "This is a budget which achieves the priorities of our party, reaches the needs of the American people, provides for a strong national defense and pays for it."

Quoting from Reagan's nationally televised speech Monday night asking for the help of the American people in getting Congress to enact "responsible deficit reduction," Byrd said: "This is a responsible deficit-reduction package. We still have to implement it, and I hope we have the president's help."

In the face of Reagan's intensified criticism of Congress for considering higher taxes to reduce the deficit, Byrd and other Democratic leaders have stepped up their efforts to blame the Republican administration for deficits that last year reached $220 billion.

Gray predicted that the conferees will formally endorse the compromise today. However, it took considerable pressure from House Speaker Jim Wright (D-Tex.) and other leaders to sway several liberal House conferees who felt they were being asked to cave in to the Senate on defense spending.

Rep. George Miller (D-Calif.) argued that the compromise promises deficit reduction but in future years would allocate the bulk of the increased taxes to higher defense spending. "The test is not whether we can govern but whether we are governing badly," he said. "If we increase taxes and we're not reducing the deficit, that's not what {Democrats} should be taking to the public."