WARSAW, Poland (AP) _ Negotiators worked against the clock to resolve differences so the government and opposition can sign a historic pact Wednesday to make Solidarity legal again and bring free elections to communist Poland.

Although last-minute agreements on trade unions and political reforms were announced between Solidarity and authorities Tuesday night, it was still uncertain if an overall pact would be signed Wednesday.

The opposition said an objection to Solidarity's wage indexing plan by the official trade union organization, OPZZ, could undo the entire deal on political and economic reforms after two months of grueling bargaining.

''We are in a deep and serious impasse,'' said Solidarity spokesman Janusz Onyszkiewicz.

He said Solidarity's National Executive Commission will meet in Warsaw Wednesday morning to decide if Solidarity could sign the accords without OPZZ's agreement on a formula for indexing pay to the cost of living.

''Today we can only say that all possibilities are open,'' he said when asked at a news conference if the free trade union movement might sign a partial accord or refuse to sign any accord at all.

Solidarity leader Lech Walesa, exhausted after a 10-hour negotiating session, went home to Gdansk Tuesday. Spokesmen said he would return to Warsaw in time for any signing ceremony.

Negotiators reached a final agreement on trade unions Tuesday that would restore Solidarity's legal status and reinstate people fired for union activity after the December 1981 imposition of martial law, Solidarity negotiator Jacek Merkel announced.

A team on political reforms successfully concluded talks late Tuesday night, PAP reported. The accord included bringing the opposition into Parliament.

PAP gave no details, but earlier Onyszkiewicz said Solidarity won a concession that a two-thirds majority in the Sjem, or parliament, would be required to override the new senate's veto of parliamentary measures. Authorities had wanted a smaller majority to be able to override the senate, which is expected to become a bastion of the opposition.

PAP also said the Politburo, the top Communist Party body led by Poland's leader, Gen. Wojciech Jaruzelski, met Tuesday to discuss preparations for a final signing on Wednesday.

It said the Council of State, also headed by Jaruzelski, meanwhile reviewed proposed changes in the constititution before they were sent to parliament.

An extraordinary committee of the Sejm focused its discussions on the proposed new senate and presidency, key elements of the round-table agreements between authorities and Solidarity, the agency reported.

If a final agreement is signed Wednesday, parliament would meet as early as Friday to enact the agreements into law, the government has said.

Monday would see the beginning of Poland's first open, competitive election campaign since Communists consolidated power after World War II, opposition sources said. The opposition tentatively set two meetings this weekend to plan for the elections. The Communist Party has scheduled a pre-election conference May 4-5.

Authorities proposed the round-table negotiations in August during strikes that roughly coincided with the anniversary of Solidarity's founding in the labor turmoil of 1980.

Leaders of the official unions opposed Solidarity's indexing formula to increase wages by 80 percent of the inflation rate. They want payments of 100 percent of inflation regardless of a worker's pay.

Under the OPZZ formula, if the average cost of living went up by 50,000 zlotys in a given month, that sum would go to a worker earning 50,000 as well as to one earning 150,000.

Poland's annual inflation rate is more than 60 percent, shortages of consumer goods are chronic and the foreign debt is $39 billion.

A statement the official unions adopted Monday said the Solidarity formula would ''not contribute to a cooling down of unrest but can even lead to its aggravation.''

Spokesman Franciszek Ciemny said in an interview Tuesday, however, that the official unions wanted to work the problem out and ''if the issue of indexation was to break up this table ... something is wrong.''

The government created OPZZ to replace Solidarity when the independent union movement was banned in 1982 under martial law, but the official alliance has taken an independent, militant position in the talks.

If Solidarity becomes legal again, OPZZ will lose its union monopoly and have to compete for worker support.

Negotiators reached a broad outline of agreement early in the negotiations, which began Feb. 6.