SAN FRANCISCO, Oct. 21— Dan White, the man convicted of shooting to death Mayor George Moscone of San Francisco and fellow Supervisor Harvey Milk in 1978, committed suicide today, the police said.
Mr. White, who was 39 years old, was found in a car in the garage of a house owned by his wife in San Francisco's middle-class Excelsior district.
Officers investigating Mr. White's death said his brother, Tom, found his body about 2 P.M. A rubber hose, they said, had been used to pipe lethal carbon monoxide into the car.
'This Was a Sick Man'
''We've said all along there were three victims in this,'' Douglas R. Schmidt, Mr. White's lawyer, said. ''Today Dan White became the third victim.''
Mr. White, who had been released from prison Jan. 6, 1984, after serving five years, one month and nine days in jail for the killings, had been troubled since his release, his lawyer said.
''His family life was less than satisfactory because he was so devastated by having created this situation,'' Mr. Schmidt said. ''This was a sick man,''
He said Mr. White's suicide vindicated his controversial plea of ''diminished capacity'' at the 1979 trial.
Mr. White admitted to the police shortly after the shootings on Nov. 28, 1978, that he had killed the two officials because he believed they would not let him rescind adecision to resign from the Board of Supervisors.
Controversial Plea at Trial
Mr. Milk was one of the nation's first acknowledged homosexuals to be elected to major public office, and many homosexuals said that was a factor in his death.
Mr. White's lawyer argued that his client was mentally unstable and had a ''diminished capacity'' at the time of the shooting, in part, he argued, because Mr. White had an addiction for sugary junk foods.
Although critics deplored what they called the ''Twinkie defense,'' it succeeded with jurors.
When they convicted Mr. White of voluntary manslaughter rather than murder, thousands of protesters, including many members of the homosexual community here, marched to City Hall where they met the police in a violent confrontation.
In San Francisco, Mr. Milk came to be revered among many homosexuals as a kind of martyr whose death encouraged them to become more agressive in seeking political power.
Mr. White, after entering San Francisco's domed City Hall through a basement to avoid a metal detector, shot Mr. Moscone and Mr. Milk.
Mr. White never expressed public remorse for the murders and apparently died without doing so.
Police Capt. Michael Lennon, speaking to reporters at the house where Mr. White's body was found, said Mr. White wrote several notes before he died, but that none referred to the shootings.
Captain Lennon said that the notes ''apologized for all for all the trouble his death would cause.''
Spent Time in Ireland
For the first year after his release from the Soledad State Prison, Mr. White was required to live in the Los Angeles area where he reported weekly to a parole officer. After the parole expired, Mr. Schmidt said, Mr. White had lived at his home here and had spent several months in Ireland.
Mr. White, a San Francisco native and the second of nine children, was often referred to as ''an all-American boy'' in news accounts after the shootings. He was a star athlete in high school and spent a year in the Vietnam War as a paratrooper, then returned home to work first as a policeman and then as a fireman.
In 1977, with strong support from the city's police union, whose leaders were angry over what they perceived as growing official tolerance of crime and of overt homosexuality and prostitution, he was elected to the Board of Supervisors on a conservative platform.
Turned Down by Mayor
But a year later he resigned, saying that his salary, $9,600 a year, was not enough to support his family, and that he was unhappy with the ethics he found in the political world.
After his police supporters advised him to change his mind, Mr. White asked Mr. Moscone to let him rescind the resignation. The Mayor turned him down. Several days later, he killed the Mayor and Mr. Milk.
In a long, rambling confession to a detective who had been one of his friends, Mr. White, weeping, said, ''I saw the city as going kind of downhill.''
A play based on the trial of Mr. White is scheduled to be presented on Broadway in New York in February.
The play, ''Execution of Justice,'' written by Emily Mann, drew critical praise and full houses when it was produced at the Arena Stage in Washington last spring.
Mr. White is survived by his wife, Mary Ann; two sons, Charlie, 7 years old and Rory, 4, and an infant daughter, Laura.
''I hope it's the last chapter,'' Police Chief Cornelius Murphy told an interviewer after Mr. White's suicide was confirmed. ''I don't think that this is the kind of book that's been written that needs an epilogue. It's time to close the book on Dan White. Let the White family and the City and County of San Francisco get on with its business.''