For the first time in this year of austerity politics, the Senate yesterday had a chance to vote to cut the federal budget. It did so -- but barely.

The issue at hand was small -- whether to accept President Carter's proposal to eliminate $168 million for health-related spending appropriated last year. But the symoblism was great, as several senators noted, and the result was thoroughly ambiguous.

Sen. Edward M. Kennedy (D-Mass.) took up the rhetorical cudgels for no cuts at all. Working against a heavy lobbying campaign from the White House -- but with the support of intense pressure from the country's nurses and medical schools -- Kennedy was defeated, 55 to 42. By that vote the Senate decided it wanted some cuts.

Sen. J. Bennett Johnston Jr. (D-La.) urged his colleagues to support the president and approve all of the cuts. He argued that aid to medical and nursing schools -- the largest item under discussion -- was a classic example of the kind of marginal expenditure Congress would have to eliminate to satisfy the public outcry for budgetary restraint.

"If we cannot cut this, where spending is clearly not necessary," Johnston told his colleagues, "then we cannot cut anywhere."

Johnston's motion was defeated 83 to 14.

The Senate then adopted, by voice vote, a compromise wrought by its Appropriations Committee. It calls for cutting $46.4 million, about one-fourth what Carter suggested -- much less than Johnston wanted, and more than Kennedy proposed. "A fair compromise," declared Sen. Warren G. Magnuson, chairman of Appropriations.

The debate and vote yesterday demonstrated vividly the impact on the Senate of the popular tide many politicians perceive rushing toward a leaner federal budget. The dispute also revealed that interest groups can still muster political resources to try to stem that tide.

In fact, yesterday's vote probably represented a modest victory for the nation's medical schools and nurses, both of which lobbied intensely against Carter's proposed cuts. In the House earlier the medical schools won a total victory, the nurses did less well.

Yesterday's Senate vote would reduce federal aid to medical schools from the current level of $1,400 per student per year to something less than $1,150 a year. For nurses, the Senate voted to cut $6 million a year from similar "per capita" grants to nursing schools, a substantially less significant sum.

These schools and their senatorial allies argued that when Congress appropriated funds for them last year, they proceeded to plan their budgets accordingly, and committed themselves to certain spending levels. Now the administration proposes a "recision" of some of those funds, leaving the schools in the lurch.

Kennedy argued that the government had "entered into a contract" with the medical schools that should not be violated.

He noted that in return for this money, the medical schools had agreed to train a much higher percentage of general practitioners who could provide "primary care," something desperately needed in remote and impoverished sections of the country.

Johnston replied that per capita aid to medical schools would not convince young doctors to practice in unappealing areas, that medical students who stood to earn large incomes did not deserve additional federal aid, and that the government is now predicting a substantial surplus of MDs in the country by 1990.

Both sides of the argument got support from surprising quarters. For example, Kennedy was backed by Orrin Hatch (R-Utah), one of the most conservative members of the Senate, who said cutting the aid now would be "an act of bad faith" by the government. Johnston, on the other hand, was supported by two relatively liberal Democrats, -- Gary Hart (D-Colo.) and Richard B. Stone (D-Fla.).

Sen. Edmund S. Muskie (D-Maine) rose to call for some cuts on the grounds that Congress was in dire danger of seeing the budget for 1979 exceed the limits it legislated last year.

Numerous liberals voted against Kennedy and for the compromise cuts, including Thomas F. Eagleton (D-Mo.), Frank Church (D-Idaho), Hart, John Glenn (D-Ohio) and Patrick J. Leahy (D-Vt.), all up for reelection in 1980.