A divided Supreme Court ruled yesterday in a privacy case from Baltimore that police may record the telephone numbers dialed from a home or office without obtaining a search warrant.

The justices voted 5 to 3 to uphold Maryland's highest court in the first case to reach them on the constitutionality of the pen register, a device installed in telephone company facilities to record a list of numbers dialed from a specific phone.

Installation and use of such a device is not a "search" for which the Fourth Amendment to the Constitution would require a warrant, Justice Harry A. Blackmun wrote in the opinion for the court. The Fourth Amendment prohibits "unreasonable searches," and requires that no search warrants be issued except "upon probable cause."

Blackmun expressed doubt that people in general entertain any actual expectation of privacy in the numbers they dail.

"All telephone users realize they must "convey" phone numbers to the telephone company," Blackmun continued. That's because they know company switching equipment must be used to complete their calls, he said.

In a 1967 ruling, the court held that the Constitution protects conversation on a phone in a public booth from electronic device, Blackmun emphasized, pen registers - or, for pushbutton phones, touch-tone recorders - "do not acquire the contents of communications."

By contrast, Justice Potter Stewart said in a dissent to the majority opinion that the numbers a person dials "are not without 'content.' Most private telephone subscribers may have their own numbers listed . . . but I doubt there are any who would be happy to have broadcast to the world a list of the local or long distance numbers they have called.

"This is not because such a list might in some sense be incriminating," Stewart wrote, "but because it easily could reveal the identities of the persons and the places called and thus reveal the most intimate details of a person's life."

Justice Thurgood Marshall said in a second dissenting opinion that "the prospect of unregulated governmental monitoring will undoubtedly prove disturbing even to those with nothing illicit to hide. Many individuals," he said, "including members of unpopular political organizations or journalists with confidential sources, may legitimately wish to avoid disclosure of their personal contacts. Permitting governmental access to telephone records on less than probable cause may thus impede certain forms of political affiliation and journalistic endeavor that are the hallmark of a truly free society."

Both the Stewart and Marshall dissents were signed by Justice William J. Brennan Jr.

The decision grew out of the March 1976 robbery of Patricia McDonough, who gave police a description of the robber and of a 1975 Chevrolet Monte Carlo she had seen nearby.

After the robbery, McDonough began to receive threatening and obscene phone calls from a man identifying himself as the robber.

Several days later, police spotted a man fitting the description McDonough had provided driving a Monte Carlo. By checking the license tag, offiders traced ownership of the car to Michael Lee Smith.

The next day, the phone company, at the police department's request, installed a pen register at its central offices to record numbers Smith dialed from his home. The day after that, the device recorded a call to McDonough's phone.

On the basis of this and additional evidence, police got a warrant to search Smith's residence. His phone book, they found, had a page turned down to McDonough's name and number.

Smith was arrested, identified by McDonough, and indicted. In Baltimore criminal court, he requested that all evidence derived from the pen register be suppressed. The judge denied the request and the Court of Appeals affirmed his decision, 4 to 3. The arguments of both the majority and the minority were close precursors of yesterday's Supreme Court opinions.

Justice Blackmun, in the opinion for the court, wrote that "all subscribers" do not actually expect privacy in the numbers they dial, partly because they "realize . . . that the phone company has facilities for making permanent records of the numbers . . . "

Their toll calls are listed on their bills, he pointed out. Moreover, he said, phone companies routinely use pen registers to check billing, detect fraud, prevent law violations, and aid in finding persons making annoying or obscene calls.