President Reagan yesterday signed a resolution to fund the federal government through March 31 that cuts spending about $2 billion more than an earlier version he vetoed last month, shutting most agencies down for a day.

The resolution virtually closes out this year's battle of the budget.

Reagan said the new resolution represents "a genuine attempt at spending restraint." It finances the government at an annual spending rate of $412 billion. While it gives Reagan twice as large a cut as the vetoed resolution, it gives him less than half the $8.4 billion in cuts he asked for in September in programs subject to the congressional appropriations process.

He also asked for nearly $8 billion in other deficit-reducing steps then, most of which have gone by the boards.

For all the president's budget cutting, federal spending this fiscal year will be a record high.

In an attempt to heal some of the wounds opened when he made his second round of budget-cutting proposals in September, the president paid a surprise visit to a group of 24 moderate Republican members of Congress who had balked at how far he was cutting into social programs.

Dropping briefly into the White House executive mess to speak to these so-called Gypsy Moths, Reagan tried to soothe their electoral as well as budgetary concerns.

He told them his 1983 budget will not hurt their mostly northeastern, urban constituencies badly with new cuts. White House chief of staff James A. Baker III reassured them particularly that Comprehensive Education and Training Act job programs would not be sliced as deeply as has been reported.

Reagan also told them he hopes they all win reelection in 1982, according to a meeting participant.

The moderate Republicans spent an hour with Baker before Reagan made his unscheduled visit to them.

By signing the spending resolution in the Oval Office, Reagan put his blessing on a compromise that was worked out between Republican members of Congress and the White House after the veto on Nov. 23.

In effect, the president was given the dollar total he said was the highest he would go in exchange for shifting the cuts to protect programs vital to northeastern Republicans such as Rep. Silvio O. Conte (R-Mass.).

Before signing, Reagan read a brief statement in which he said he would prefer government to be financed through the separate appropriations bills for each department as required, but that this resolution was acceptable and a "big change from the business-as-usual approach." He thanked the members of Congress for their cooperation.