The government can legally require drug testing for millions of federal employes, Attorney General Edwin Meese III said yesterday, but members of Congress and a major federal labor union said they would oppose such a requirement.

A recommendation for mandatory drug testing of government workers and employes of any contractor receiving government funds was contained in a report on drug trafficking released Monday by the President's Commission on Organized Crime.

Meese told reporters yesterday that the Justice Department and the Cabinet would review the proposal, along with others made in the report.

Asked about complaints that mandatory drug testing would violate an employe's Fourth Amendment protection against unlawful search and seizure, Meese said, "By definition, it's not an unreasonable seizure because it's something the employe consents to as a condition" of employment.

Judge Irving R. Kaufman of the 2nd U.S. Circuit Court of Appeals, who heads the commission, said the testing is no more an invasion of privacy than requiring citizens to walk through metal detectors in airports and courthouses.

Meese said many drug test programs can be implemented under existing statutes without congressional approval. But he stopped short of saying the government would conduct widespread testing.

"This is a costly process," Meese said, adding that the government must weigh the need for testing against the cost and the effect on the work force.

Meanwhile, Kenneth T. Blaylock, president of the 210,000-member American Federation of Government Employes, said his group will go to court to fight any government attempt at mandatory drug testing.

"We've been in business for a long time, and nowhere do I see that federal employes consent to such a search" when they apply for federal jobs, Blaylock said. "We're preparing for a scrap over it . . . . There is already case law showing that federal employes don't leave the constitutional rights at the door when they sign on."

Several members of Congress issued statements opposing the proposal.

"Trying to stop organized crime's multimillion-dollar drug business by creating a police state in federal office buildings would be ineffective and would create one crime to stop another," said Charles E. Schumer (D-N.Y.), a member of the House Judiciary Committee.

"Does this mean we're shifting away from going after crime syndicate kingpins and instead beginning to harass the average civil servant because he or she is easier to find?" he asked.

Rep. Patricia Schroeder (D-Colo.) charged in a letter to President Reagan that "if a prize were created for the most idiotic recommendation of a presidential commission," the drug-testing recommendation "would surely be the winner."