The nation's railroads were reported yesterday to be "very close" to a tentative new contract with four unions that would exceed the Carter administration's anti-inflation goals for wage increases.

One source close to the bargaining said negotiators were talking "in the range of 35 percent" for wage increases and cost-of-living adjustments over the three-year life of the contract. But some government officials said they would be surprised if the money settlement turned out to be that high.

"It would be totally out of line . . . just awful," said an official with the Council on Wage and Price Stability.

He and other officials acknowledged, however, that the eventual rail settlement is virtually certain to exceed the administration's goal of 30 percent or less over three years for the rail industry.

The White House and the council had been pushing in the rail talks to break the 30-plus percent pattern of union contract gains over the past couple of years, hoping a low rail settlement would set the stage for restraint in next year's heavy round of contract bargaining, starting with the Teamsters.

They have been trying to do the same in current postal negotiations, also without success. The White House has been seeking to hold wage increases to 5.5 percent a year, but the postal unions are balking and countering with a demand equivalent to 14 percent for next year.

The postal talks are virtually at an impasse, with contracts due to expire in two weeks. Scattered work stoppages are considered possible if a settlement is not reached, although strikes are technically illegal.

Under the complicated negotiating machinery of the Railway Labor Act, a rail strike is not imminent, even though contracts covering more than 400,000 workers expired in December. But a settlement has been reported near several times over the last few weeks, and yesterday reporters were summoned to the National Mediation Board, where the talks are being conducted between the National Railway Labor Conference, the industry bargaining group, and four of the 13 railroad unions.

The four are the United Transportation Union, the largest of the 13, and the Brotherhood of Locomotive Enginneers, Maintenance of Way Emplyees and Sheet Metal Workers. Together they represent more than half of all union rail workers.

No official statement was issued, but union sources said the parties were "very close" and indicated that an annoucement may be made Monday or Tuesday. The unions have tentatively scheduled negotiating committee meetings for Tuesday to review the proposal if it is ready, sources said.

It was understood that the Brotherhood of Railway and Airline Clerks, the second-largest rail union, has major problems with the proposals now on the table, including wage provisions. BRAC is negotiating separately with railroads, as are the other unions. Negotiations with the quasi-government Conrail system are also being conducted separately.

Normally the first settlement serves as a pattern, but BRAC officials have been talking of a bargaining impasse, which would trigger more government conciliation efforts before the unions would be free to strike sometime in the fall, unless Congress intervene.

If the pact now under consideration approaches 35 percent, it would top the last rail wage settlement of 33 percent, which now gives the average rail worker an hourly wage of $7.75, according to gaovernment statistics. It also would exceed the 31 percent wage gain won by the United Mine Workers earlier this year as part of an overall 39 percent increase in fringe benefits and wages. The UMW contract has been held up as an example of the kind of inflationary settlement the government wants to avoid.

Earlier in the negotiations, the rail companies reportedly backed off their push for a reduction in freight-train crew size as part of a nationwide rail contract. Their goal was to reduce the crew size from four to three by lopping off one of the two brakemen. The unions say they have agreed to negotiate the issue as a part of local, or company-by-company, settlements.