The YMCA's search for a building to replace the historic Anthony Bowen branch in Shaw, which closed five years ago, appears to be at an end. Officials announced yesterday they will purchase a building near 14th and W streets NW, five blocks north of the original building.

"We are happy, very happy," said Thomas B. Hargrave Jr., president of the YMCA of Metropolitan Washington. "It was a very good buy and it keeps us in a community with a great need for our services."

The 20-year-old building, owned by the Hillcrest Foundation, was built as a school for handicapped children but is currently used by several community-based organizations, Hargrave said. The building, estimated to cost $3.25 million, comes complete with a small swimming pool and gymnasium and three floors of office space, some of which would be used for community programs.

Response to the news from the tenants in the building at 1325 W St. NW and from some community leaders was cautious. Most were concerned about displacement of the organizations currently occupying the building.

The plan to purchase the building follows the controversial closing in 1982 of the city's YMCA facility at 1816 12th St. NW when Hargrave and other officials determined the building was unsafe after more than 70 years of operation.

Because the building was built by blacks and for years remained the only black YMCA building in town during segregation, its closing struck an emotional blow to the community it served. Critics were quick to say the YMCA had lost its sense of purpose and was more interested in catering to the well-to-do who could afford the expensive memberships at the multimillion-dollar building completed in 1978 at 17th Street and Rhode Island Avenue NW.

After the Bowen YMCA closed, it reopened in a small building at 1307 W St. NW. But the storm of protest generated by the closing of the building, named in 1973 for former slave Anthony Bowen who founded the first YMCA in his Washington home in 1853, would not die.

D.C. developer Jeffrey N. Cohen bought the 12th Street building in 1985 for $175,000 with the restriction that he lease it for $1 a year to the Shaw Heritage Trust, which would be responsible for restoring the building.

The trust expects to select the organizations that will occupy the building later this month, according to trust President Norris A. Dodson III.

The neighborhood around the proposed building reflects many of the problems of some of Washington's poorest communities. An entrenched heroin and cocaine market still thrives a block away at 14th and W streets NW, despite efforts by the department to dislodge it.

Although the city two years ago built a municipal center three blocks away, resulting in soaring property values, little has changed in either the residential or commercial blocks that are dominated by boarded-up buildings and empty lots. Metro construction also has slowed progress in the neighborhood.

But the problems of the area don't disturb Hargrave. "We will combat the problems of drugs and prostitution in that neighborhood by creating positive role models for the children who live there," he said. "Our new building will give us space to do that."

Hargrave said he plans to open the new YMCA building in January and expects to offer a lease to the Washington, D.C. Parent Child Center Inc. now occupying the first floor of the building. The community-based organization operates an extensive day-care program catering to the needs of children ages 6 weeks to 6 years and to their parents who need assistance with job training.

The center is so popular in the neighborhood that Advisory Neighborhood Commission Chairman Norman Wood said he would support the YMCA's proposed move only if it assured him the Parent Child Center would not be displaced.

"I would oppose any other community organization going into that building if it forced the center out," he said. "The Parent Child Center is much more valuable than anything else in the area."

Officials for the other major tenant, Cities in the Schools, a national organization that brings together city and community services to assist troubled students, said they would have difficulty relocating.

Donald Robinson, the D.C. director for the local branch of the organization, said he felt it would be a "tremendous disservice to the 500 young people and their families who we assist" if they had to move.

Hargrave said the YMCA would expect to occupy the space now used by the Cities in the Schools. He said the Hillcrest Foundation, which owns the building, occupies some office space and would be allowed to continue to do so.

Ibrahim Mumin, former chairman of the Shaw Heritage Trust and president of the nonprofit Shaw Coalition Redevelopment Corp., said he was pleased. However, he was concerned that the YMCA may renege on its agreement to occupy a part of the old 12th Street building.

"They had a commitment to us to be a presence in that building," Mumin said. "Assuming that they honor that commitment, I would be comfortable with their plans."

Hargrave said he wasn't sure if the YMCA would use the 12th Street building.

"When we agreed to participate in the building, that was three years ago. We thought that project was on the fast track. We finally reached a point where we couldn't wait any longer. There are too many kids in the streets in need of our help."