DHAKA, Banghladesh (AP) _ Military ruler Gen. Hossain Mohammed Ershad, who officially won an overwhelming popular vote of confidence as president on Thursday, says that Bangladesh must have a democratically elected government ''as soon as possible''.

But in an interview with The Associated Press Friday, he ruled out immediate relaxation of stringent martial law, a quick release of two opposition leaders from house arrest, or freedom for hundreds of political opponents.

Six major universities will remain closed indefinitely because of politically oriented unrest and violence, he said.

''The restrictions stay and will be lifted gradually as soon as we are certain that law and order will be maintained,'' he said.

Ershad, 55, who seized power in a bloodless coup on March 24, 1982, denied opposition party allegations of vote rigging, bribery of voters, a trifling turnout and juggled statistics.

''The people may be poor and illiterate, but (they are) wise,'' he said. ''The voting was absolutly fair, turnout was high, rigging was not necessary, and we could not have afforded so many bribes.''

In Thursday's referendum, voters were asked if they supported Ershad's policies and programs and wanted him to stay on as president until national elections could be held.

Final official results released Friday gave Ershad a 94 percent vote of confidence or ''yes'' vote. About 72 percent of the 48 million eligible voters turned out, the election commission said. It said that of 34.5 million votes cast, 32.5 million were in favor of Ershad's policies.

Bangladesh, a nation the size of Wisconsin, contains 100 million people.

Twenty-two opposition parties rejected the referendum results, saying the turnout was less than 5 percent. The opposition vowed to continue its struggle against three years of martial law.

At least 50 Moslem fundamentalists staged a brief demonstration in Dhaka on Friday, shouting slogans against the referendum and jeering at official results.

Ershad announced the referendum on March 1 after the opposition said it would not take part in elections for Parliament scheduled for April 6 unless martial law was lifted. It was the fourth election they had rejected.

Before the referendum Ershad re-imposed rigorous martial law, which had been relaxed. His banned all opposition political activities, imposed censorship, and had several hundred political opponents arrested.

Many local and foreign political observers said with the referendum Ershad's position was strengthened and the fragmented opposition appeared ineffective.

''Their troublemaking capacity is over now,'' Ershad said. ''If they had the strength to disrupt the referendum or create violence as they vowed, they would have done so. Their non-cooperation movement failed and 2 million people voted against me, showing they took part.''

''We must go to a democratic system,'' he said. ''I did my best to hold elections but the opposition refused. I hope as soon as possible to have democratic government. Martial law should not be there forever.''

On Thursday foreign correspondents taken to polling stations by the government saw voters line up on their arrival and disperse when they left. But Ershad said reporters were wrong in interpreting what they saw as vote rigging. ''Our voters are so scattered that they must be gathered together,'' he said.

He said he would review the house arrest of two main women opposition leaders - Begum Khaleda Zia, chairwoman of the Bangladesh Nationalist Party and Sheik Hasina Wajid of the Awami League. But he said they were in their homes and their security was a major concern.

''As soon as possible we will look into the situation to see they have a normal life,'' he said. He said the government would review the detention of ''troublemakers'' - unofficial estimates range from several hundred to 2,000 - and release them later. Universities would reopen ''in due course but not right away,'' he said.

''We are not the world basket case,'' he said. ''We are improving and if we can control our population we will survive.''