U.S. Postal Service employes won higher pay and lifetime job guarantees in a contract settlement imposed yesterday by a special federal mediator.

But union leaders expressed unhappiness with a decision by mediator James Healy that makes it possible to lay off workers hired in the future.

Previous contracts and tentative settlements rejected earlier this year by union members included a ban on layoffs. Postal management has been seeking to eliminate the layoff protection because future mechanization could require fewer workers.

Postmaster General William F. Bolger, for his part, warned that a decision by Healy to permit higher cost-of-living increases than agreed to earlier could jeopardize a promise by management not to boost postage rates in the next 2 1/2 years.

"It is clear that meeting this goal will depend in large part on the nationwide rate of inflation . . . If inflation does not exceed an annual rate of 7 percent, I believe we have a fighting chance to meet our goal," Bolger said last night.

Currently, the annual rate of inflation in consumer prices is running at about 8 percent.

Bolger would not comment directly on Healy's decision about future layoffs, but he predicted no disruption in the nation's mail service, "now that this long and tedious process is over."

However, at least two of the three unions involved in the 5-month labor dispute intend to hold ratification elections on yesterday's decision. The Postal Service and unions agreed earlier to abide by Healy's findings. Some local leaders of the largest union - the American Postal Workers with 299,000 members - have threatened to strike if they did not approve of Healy's decisions.

The mediator's contract would increase annual wages by an average $300 more over three years than would settlements rejected earlier by union members.

Spokesmen for the three unions, which have 516,000 members, estimated that the new pact adds up to a 21.3 percent wage increase over three years compared with 19.5 percent under the rejected contracts.

In addition, Healy's decision would provide for higher wages if the rate of inflation increases. The earlier contracts had included a "cap" of 9.5 percent over three years on how much workers could earn with living-cost adjustments.

Despite the increase in the total wage package, the new contract was considered to be acceptable to Carter administration inflation fighters. Contracts signed earlier this year provided wage increase of 37 percent for the United Mine Workers and 35 percent for major rail unions over three years.

An average postal worker now earns $15,887 a year. That could rise to about $19,500 by 1981 under yesterday's decision.

On the controversial layoff issue, Healy decided in favor of lifetime security for two classses of workers: all those employed as of yesterday, and any who become members of the regular work force starting today once they have completed six years of continuous employment.

For all other workers, the Postal Service "shall have the right to effect layoffs for lack of work or for other legitimate decision" starting next July 20, said Healy in his arbitration decision, unique in postal history.

"I'm not entirely pleased . . . We got some of the things we wanted," was the assessment for reporters yesterday by Emmet Andrews, president of the American Postal Workers Union.

But Lonnie Johnson, head of the 36,000-member National Mail Handlers, said flatly: "I do not like the contract. I don't like any messing with the no-layoff clause."

Johnson said he won't submit the decision to his members for a vote, however. Healy "split it down the middle but it was a little bit toward the management," Johnson added.

Andrews of the APWU said he expects his members to ratify the contract, despite misgivings.

Joseph Vacca, president of the 180,000-member National Association of Letter Carriers, also plans to submit Healy's decision to a membership vote. If rejected, there probably would be an illegal strike, he stated.

Healy declined to "make any comments about the contents of my decision . . . a very fair and equitable decision."

A labor relations professor at Harvard Business School, Healy was brought into the dispute when federal mediation failed to bring labor and management together after a July 21 contract proposal was rejected by the three unions' rank-and-file. A fourth union, the 50,000-member Rural Letter Carriers, approved the original proposal.

Healy agreed to conduct 15 days of negotiations and then to impose a settlement if there was no agreement. The decision yesterday was confined to the two major issues of wages and job protection.

"The insurance is in the unlimited cost-of-living increase," said James LaPenta, secretary of the unions' joint bargaining committee, in describing Healy's arbitration. The total package would exceed 21.3 percent over three years if the inflation rate tops 6.5 percent, as measured by the consumer price index.