Iran's controversial military police commander, Gen. Amir Seif Rahimi, was reinstated today on the orders of Ayatollah Ruhollah Khomeini less than 24 hours after the government had announced his dismissal.

Khomeini's order represented another humiliation for Prime Minister Mehdi Bazargan's provisional government, which had fired Rahimi after his comments to the press yesterday alleging a plot to get rid of him and to weaken the revolution.

No official announcements have been made by Khomeini, but aides at his headquarters in the holy city of Qom today quoted him as saying that Rahimi would remain in office. One aide said, "When Ayatollah Khomeini orders something no one has the right to refuse."

There appears to have been no consultation between Khomeini and the government on the handling of Rahimi's case. Contacted after the first report emerged that Rahimi was not to be dismissed, minister of Defense Taqi Riahi, who had signed the dismissal order, said he had no knowledge of such a development.

The government is making no move to oppose or even question Khomeini's instructions. In a comment echoed by the chief of staff, Gen. Nasser Farbod, Riahi said today, "The decision of Imam Khomeini is above that of myself and the government, and I obey his orders."

He added, however, that the Cabinet certainly would raise the issue during its next meeting with Khomeini.

While the dispute within the millitary appeared at least temporarily defused, the government was reminded today of another serious threat to Iranian security with the appearance of leaflets in the name of an unknown underground organization claiming responsibility for explosions that last week damaged Iranian oil installations.

The group called itself "Black Wednesday," -- after a day at the end of May when gunfighter erupted in the southern town of Khorramshahr between Iranian Arabs may have been killed. There has been no other information to confirm the existance of such an organization or the links, which its name implies, with autonomy-seeking Arabs in the southern province of Khuzestan.

There has been mounting concern about the danger of further violence in the province with reports that large quantities of arms have been smuggled in from neighboring Iraq.

There has also been serious concern about the vulnerability to sabotage of vital installations handling Iran's crude oil production and exports.

The damage caused by last week's explosions is still not fully known. But the breakage in pipelines carrying refined products from Iran's biggest refinery at Abadan to the nearby export forced a sharp drop in refinery production. Output now is just 100,000 barrels a day, less than a fifth of capacity.

The Black Wednesday leflet appeared during a day of marches in Khorramshar to mark the end of the traditional Moslem 40-day mourning period for those who died in the fighting.

Tens of thousands of Iranian Arabs from several towns in Khuzestan are reported to have participated in the demonstrations, carrying black flags and chanting bitter anti-government slogans.