The Supreme Court ruled 7 to 2 yesterday that the presence of a police undercover agent at two pretrial meetings between a criminal defendant and his attorney was not an automatic violation of the defendants constitutional right to counsel.

The police agent did not attend the meetings because he wanted to spy, the court said, but because he had been invited by the unaware defendant and lawyer, both of whom might have become suspicious had he stayed away.

Moreover, Justice Byron R. White said in an opinion for the majority, the agent, Jack M. Weatherford of the South Carolina State Law Enforcement Division, did not discuss the defense trail strategy or a pending criminal action with his superiors or prosecutors.

The decision reversed the Fourth U.S. Circuit Court of Appeals, which had ruled that "whenever the prosecution knowingly arrange and permits intrusion into the attorney client relationship, the right to counsel is sufficiently endangered to require reversal and a new trial."

Dissenting Justice Thurgood Marshall, joined by Justice William J. Brennan Jr., said even this "narrowest of openings to . . . spying upon attorney-client communications" undermines the integrity of the adversary system, the fairness of trials and the right of criminal defendants "to the effective assistance of counsel."

The "precious constitutional rights at stake here . . . need 'breathing space to survive'" and can be protected only with a "prohibition on all intrusions of this sort," Marshall said.

The defendant, Brett A. Bursey, had sued Weatherford after serving an 18-month sentence for vandalizing Selective Service offices in Columbia, S.C., in 1970. Weatherford participated in the offense and was arrested and charged with Bursey. Immediately released on bond, Weatherford met twice with Bursey for discussions of the approaching trial with defense lawyer Frank Taylor Sr.

Weatherford had assured Bursey he would not testify for the prosecution, but did so. This was "not deliberate" and did not deny Bursey's right to a fair trial, the court held.

In a burst of other actions after a four-week recess: EHRLICHMAN APPEAL

The court rejected a request by a former White House aide John D. Ehrlichman for review of his conviction for conspiracy and perjury in the 1971 burglary of the office of Daniel Ellsberg's psychiatrist. Ehrlichman had filed the request last Sept. 14, six weeks before he began to serve a sentence of 30 months to eight years. PUBLIC EMPLOYEES

When the Sevier County School District in Utah hired Grant Mogle as a high school guidance counselor in Salina (pop. 1,494) in 1969, Superintendent Lamont L. Bennet told him that "we would like you to move over" from Centerfield (pop. 419), which is 11 miles away in another county.

Over the years, Mogle repeatedly tried to find a house in Sevier County for his wife and their six children. In 1972, the district, saying it wanted him to pay taxes in the county that paid his salary, put a clause in his contract saying it would rehire him for the 1972-1973 academic year only if he moved to the county. At the same time, the district allowed a teacher who lived in Centerfield near Mogle to stay there.

Mogle tried to anew to find a house in Sevier, but failed. The district then refused to renew his contract.

Utah courts rejected Mogle's complaint that he was a victim of discrimination. Yesterday, the high court let the ruling stand. Previously, it had upheld requirements by large cities that municipal employees live inside the city limits.

In a New Hampshire case involving the right of a policymaking official to free speech, the court let stand a decision upholding the dismissal, for insubordination, of Edward J. Bennet as director of the state Division of Resources and Economic Development.

Bennett opposed a proposed $200 million pulp mill on the ground that it would be "a catastrophe" for New England. His superior ordered him to keep quiet. In 1974, after a breakfast speech, he was asked a question about the mill proposal. It "stinks," he said in part. He was fired the same day. CONSUMERS

In an action with implications for consumers across the nation, the court refused to review a decision allowing Virginia to deny membership on its State Board of Examiners in Optometry to any citizen who hasn't been a licensed optometrist for at least five years. AGE DISCRIMINATION

More than 11 million persons belong to retirement plans that require an employee to retire by age 65; millions more are members of plans that permit employers to force retirement before 65.

At United Air Lines in 1964, technician Harris S. McMann signed an application card for a pension plan that specified 60 as the "normal retirement age." In 1973, he retired. Then he sued United on the ground that arbitrary age discrimination was the sole purpose of the requirement to retire at 60. The Fourth U.S. Circuit Court of Appeals agreed. Yesterday the high court agreed to review the decision. The firm's board, meanwhile, has asked chief executive officer Edward E. Carlson to stay on the past age 65.


The court refused to expedite consideration of a petition challenging the constitutionally of the one-house veto, a legislative device that enables either the House or the Senate to overturn a wide range of administrative actions ABORTION

For the second time, the court declined to ban the spending of federal funds for abortions not necessary to save the life of the mother.