With threats of a postal strike hanging over the heads, Postal Service and union negotiators raced the clock last night in an attempt to settle on a new contract and avert a possible strike when the current pact expires at midnight.

As of early evening, it was unclear whether an agreement would be reached by then, and, if not whether local union leaders would follow through on threats to strike.

Postal strikes are illegal, but they happen anyway. More than 200,000 postal workers walked off their jobs in 1970, and a number of union officials in New York and other major cities have been vowing, " no contract, no work."

Faced with uncertainty over the likelihood of a strike, both the government and major mail users readied contingency plans for getting along without the more than 550,000 unionized postal workers - including using federal troops or other government employes to move the mails.

Postmaster General William F. Bolger told reporters he was confident an agreement would be reached in time, but Federal Mediation and Conciliation Service Director Wayne L. Horvitz appeared less certain.

Horvitz said at a late afternoon press briefing that the two sides, which broke off direct talks in a dispute over a job security issue Monday night, had returned to the bargaining table and were "down to the crunch issues."

He said the Postal Service had made a new proposal and the unions were preparing to respond but did not elaborate.

Horvitz said he was satisfied both sides wanted an agreement and said they had "come a long way" toward one, but declined to say whether this amounted to "significant movement" toward a settlement by midnight. He said he would recommend that negotiations be extended beyond the deadline if necessary.

The key issues reportedly remained as they were from the start: job security and money. Although the Postal Service and the unions remained far apart on wages, at least until yesterday, the key stumbling block was a "no-layoff" clause in the existing contract that bars workers from being dismissed to cut costs.

The Postal Service wants it scrapped, and the unions - the American Postal Workers Union, the Letter Carriers and the Mailhandlers - insist that it be retained. Three years ago, the Postal Service held out to the last issue before relenting and settling on a contract without a strike.

On wages, the unions were asking for up to 14 percent a year in wages and cost-of-living adjustments. The Postal Service's initial money offer last week amounted to considerably less than the 5.5 percent that the White House has been proposing for government workers.

The Carter administration has made the postal settlement a symbolic linchpin of its anti-inflation program, which envisions the government as a model for voluntary restraint by management and labor in private industry. But it is also anxious to avoid a postal strike and the public-reaction it would cause.

With labor accounting for about 85 percent of postal costs, the eventual settlement could have an important bearing on postal user costs, the federal deficit and the overall inflation rate.

The Postal Service was created by Congress as a no-politics, businesslike independent agency in 1970 in hopes of eliminating the chronic postal deficits. But the deficits continued, although last year's dropped by half to $688 million. The Postal Service recently increased the price of first-class postage stamp to 15 cents, more than double the 6 cents it cost to mail a letter in 1970.

At the same time, postal salaries nearly doubled,to an average now of nearly $16,000 a year, roughly comparable to counterparts in private industry, but rising at a faster rate than other government workers.

Productivity also increased as nearly 80,000 jobs were cut through attrition and mechanization increased, but the Postal Service, in stressing elimination of the no-layoff clause, contends it needs more flexibility to reduce its payroll.

In contrast to 1970, when strikers won amnesty as part of a contract settlement, Postal Service has taken a hard line against would-be strikers, with Postmaster General Bolger warning letters to workers that strikers may be fired, prosecuted for felonies and forced to give up medical and life insurance coverage.

Yesterday the APWU executive board condemned Bolger's action, warning he "may have doomed the negotiations beyond repair," and calling on him to retract the threat. But at the same time APWU President Emmet Andrews, whose union is the largest of the three, called on local officers to avoid " any precipitous action," a veiled warning against wildcat strikes or slowdowns.

Both Andrews and J. Joseph Vacca, president of the Letter Carriers, are walking a tightrope in the talks. Both are in their first terms and face reelection at conventions in the next few weeks. Neither can afford either an unpopular settlement or strike action that brings government retaliation.

Late yesterday, government lawyers told a federal judge they would file suit to force workers back to their jobs if a strike occurs. U. S. District Court Judge Gerhard A. Gesell refused to issue such an order, requested by the conservative Public Service Research Council, on grounds it was premature. But he noted, "I'm going to be home at night."