Three Senate Democrats have warned the Justice Department that President Reagan may be violating an old and rarely cited federal law if he doesn't formally fill four top positions at the Environmental Protection Agency this week.

The law is the Vacancies Act of 1868, which was last invoked a decade ago to block the Nixon administration's effort to close down the Office of Economic Opportunity.

The act requires the president to fill vacant executive positions at federal agencies within 30 days. It was enacted to prevent the president from circumventing the confirmation process by filling executive jobs with temporary appointees for indefinite periods.

In a letter last week to Attorney General William French Smith, Sens. Daniel Patrick Moynihan (N.Y.), Gary Hart (Colo.) and George J. Mitchell (Maine) said the law gives Reagan until this Thursday to nominate a new inspector general and three assistant EPA administrators. However, one of the assistant EPA administrator jobs has been filled on an acting basis for more than a year without raising congressional questions.

The Vacancies Act got its last good airing in 1973, when a judge declared the nomination of Howard E. Phillips as OEO director illegal because President Nixon refused to submit Phillips' name for Senate confirmation. Nixon had announced his plan to shut down the OEO, and had selected Phillips to dismantle the agency. After several months, Phillips was forced to resign, and Nixon submitted another name to the Senate.

In the EPA case, Reagan filled the high-level jobs temporarily on Feb. 24, after the White House fired or accepted the resignations of several EPA officials, including its inspector general and two assistant administrators.

The White House said it was replacing the EPA officials with executives from other federal agencies so that they could report to work immediately and not need new FBI background checks.

The new executives took over the inspector general's job, two existing assistant administrator posts and a newly created assistant administrator post.

Reagan also formally named a career EPA employe to be assistant administrator for research and development, a job the employe had held for more than a year without Senate scrutiny.

A spokesman for Moynihan said all of the temporary appointees came from jobs where they had been confirmed by the Senate, but their positions at the EPA raised new and different questions.

He said Moynihan was aware of the longtime acting EPA official, but that the senator considered it a moot point when he wrote his letter last week. A Justice spokesman said the agency was drafting a response to the senators.