A Senate committee yesterday approved Pittsburgh Mayor Peter S. Flaherty to be deputy attorney general, despite opposition from some civil rights groups critical of his views on school busing.

The only dissenter in the voice vote by the Senate Judiciary Committee was Sen. Howard Metzenbaum (D-Ohio), who said he nevertheless expected the Senate to confirm the nomination. It now goes to the full Senate.

Metzenbaum said he was disturbed by testimony that Flaherty had advocated defiance of the law to prevent desegregation of the Pittsburgh schools. "All of us must conform with the law," Metzenbaum said.

Flaherty, in his testimony before the committee, denied he had urged defiance of the law. Rather, he said, he had opposed "massive school busing" as a way of bringing about desegregation.

Two Republican members of the committee, Sens. Orrin Hatch of Utah and Strom Thurmond of South Carolina, spoke out in support of Flaherty's nomination before it was approved.

Meanwhile, with one dissenting vote, the Senate yesterday confirmed the nomination of Carol Tucker Foreman, former head of the Consumer Federation of America, to be assistant secretary of agriculture for food and consumer affairs.

Only Sen. Carl Curits (R-Neb.) was heard to vote against the nomination.

Curtis had just concluded a Senate speech in which he said the nominee has no experience in agriculture and is too closely identified with organized labor.