A District of Columbia police officer, suspended from the force two years ago on discipline charges barricaded himself in his suburban Virginia home Wednesday night and held authorities at bay for seven hours before being routed by tear gas.

Prince William County Police said they took Officer Gregory Thieling, 36, into custody at 2:30 a.m. yesterday, ending a siege that had forced the evacuation of six Woodbridge homes.

Thieling, who has been seeking psychiatric retirement from the D.C. force, was charged with brandishing a firearm and was ordered held for psychological observation. Neighbors said the officer has been depressed in recent weeks and was to have met Tuesday with District of Columbia officials about his retirement request.

"I don't know the whole story, but he's been depressed," said Ralph Carder, a neighbor in the Marumsco Wood subdivision. "He was a good cop, and said that the D.C. police force had been . . . on him for two years. He was supposed to have met with them yesterday and I guess it was too much to handle."

Prince William Police Lt. Adrian L. Lemmers said the barricade incident began at dusk Wednesday when Thieling's wife, Clara, came racing out of her home, shouting that her husband was threatening to shoot himself or anyone who came near his brick, two-story home.

John Harrell, a 17-year-old neighbor, said he saw the woman leave the house and return with a friend. At that point Thieling "came out with a gun and shouted that he was going to shoot," Harrell said. "Everybody scattered then."

Police warned neighbors that Thieling had a number of weapons and ordered six nearby homes evacuated. "The police informed us that we were in the direct line of any gunfire that might ensue," said Mrs. Ralph Carder. i"It was frightening. They (the Thielings) are both very good friends of ours."

As special police negotiating team and a psychiatrist tried to contact Thieling by telephone, nine Prince William police officers took up positions in adjacent homes.

For the next six hours, Lemmers said, the psychiatrist and negotiators tried through a third party to convince Thieling to surrender, Lammers said.

"He made demands and they [the negotiators] made counterdemands. He kept saying that he wanted to go to a hospital, but he wouldn't come out," Lammers said. "His being a police officer didn't help. He knew exactly what we were trying to do."

At 2:30 a.m. yesterday with no end to the stalemate in sight, police fired five tear gas cannisters through the front and side windows of the home, but Thieling still did not come out.

"It seemed like an eternity before he eventually came out," Lammers said. "But it was eight minutes before he gave up without incident."

According to D.C. police, Thieling joined the force Sept. 20, 1971, and has been on leave without pay since March 1978. He was placed on sick leave a month earlier shortly after what police yesterday described as a disagreement between him and a sergeant at the D.C. police training academy.

According to one police official, Thieling was given an order and refused to obey it. His police powers were revoked and his badge and service revolver was taken from him, police said.

He complained at the time that he was unable to continue work because of psychiatric problems, but his request for retirement on those grounds were rejected in July 1978 by a retirement board. He has continued to appeal the case and a spokesman said he was seeing a psychiatrist at the board's urging.