TRIPOLI, Libya (AP) _ The government denied Monday that it had forced foreign workers to go to military bases and desert oil fields, which were considered possible targets of U.S. attacks.

Contradicting a statement released by the Information Ministry on Sunday, Information Director Ibrahim Seger said foreign companies had been invited to perform routine maintenance work at the bases.

''Some military camps were given over to Western companies to be fixed. I don't know the exact number,'' Seger told The Associated Press in an interview Monday.

''Work has begun,'' he said, without specifying by whom or explaining the contradition between his remarks and Sunday's statement.

All the comments were made before the United States announced its planes had attacked military and terrorist targets in Tripoli and Benghazi Tuesday morning, (7 p.m. Monday EST).

The Libyan government statement released Sunday by an Information Ministry official said: ''Foreign workers have been forced to live in (oil fields), taking into account that the majority are Americans.''

It said, ''The military camps have been handed over to the foreigners to repair them and to use them to live there. Foreign workers have been moved to army camps.''

The statement added, ''Libya has got information that America is going to attack several army camps and oil fields and petro-chemical companies.''

It is believed that some 800 U.S. workers and their dependents are still living in Libya in defiance of President Reagan's order in January that all Americans leave the country.

In Ottawa, Canadian Foreign Office spokesman Denis Tessier, said Monday that no Canadians working in Libya had reported being forced to move to potential targets of an American military strike. He said a Canadian consular official inside Libya had received no reports of movements of Canadians or other foreign workers to military bases or oil fields.

There are about 1,300 Canadian workers in Libya. Canada's prime minister, Brian Mulroney, said in Ottawa on Monday night that the United States had informed him ahead of time of its plan to attack, and Washington had been informed of the numbers and locations of Canadians inside Libya. , is attempting to determine whether any Canadians were affected by the attacks.

''We have been concerned from the outset with the safety of Canadians in Libya and indeed we have repeatedly exhorted them to look to their own safety,'' Mulroney said. Witold Weynerowski, Canada's ambassador responsible for relations with Libya, said from Tunisia it was very unlikely any Canadians were near targets of the raids.

Government officials in Seoul, South Korea, were reported to be holding urgent meetings Tuesday morning. There are an estimated 20,000 South Koreans working in Libya, but Seoul officials had declined to comment Monday on the reports of the forced movement of foreign workers.

The Spanish consul in Tripoli, Jose Sanchez Martinez, was contacted by telephone by Spanish National Radio early Tuesday and he said he had received no reports of any of some 400 Spaniards in Libya being moved to military bases.

He said he was awakened by explosions at about 2 a.m. Libyan time and he saw no unusual military activities in the streets. The Spanish Embassy is a 15-minute drive from downtown Tripoli.

Western diplomats in Tripoli, interviewed by the AP, also denied the original government assertion that foreign workers were subjected to forced moves.

One of the diplomats, speaking on condition he not be identified by name or country, said the government had asked companies based in South Korea, Sweden and West Germany to perform maintenance and repair work at the military bases according to their contracts.

He said many of the companies had asked for more time before deciding whether to undertake the work.

Many of the foreigners in Libya already live at oil fields or construction projects outside Tripoli.

Libya's official JANA news agency reported Monday that Libyan workers were leaving the oil fields to report to army barracks ''to take up arms in order to opppose any aggression.''

In Rome, Libya's ambassador to Italy, Abdulrahman Shalgam, was quoted by the Italian news agency ANSA as saying Libya ''will never use foreigners as a shield to defend the country from the United States.''

ANSA reported that Shalgam categorically denied that Libyan leader Col. Moammar Khadafy planned to transfer foreign workers at the oil fields to military installations.