After an 18-month search, officials of Frederick County's program for battered spouses have contracted to buy a large city house that will almost double the number of women they can shelter from abusive husbands, officials said this week.

Last year, the six-year-old program based housed 119 women and 130 children, who stayed an average of nine days. But 40 women and 54 children were turned away because of overcrowding at the present eight-bed shelter, said Kathleen Riley, the program director.

''This location will give us up to five more beds and three more cribs,'' Riley said. ''It will also give us more living space, a separate play room for children and a private counseling room.''

Officials of the nonprofit program for battered spouses, which is funded largely by the United Way, already have contracted to buy the $150,000 house, but they must win a zoning variance from the city's board of appeals before they can close the deal, said James Schmersahl, director of planning.

Under city zoning laws, dwellings used by charitable or philanthropic organizations must be at lease 20 feet away from other properties. The house, however, has only four-foot set-backs, Schmersahl said.

The five-member board held a public hearing on the vairance this week and is expected to make a decision on the zoning request next month, he said.

Last summer, the group dropped plans to buy a house on Clark Place, a quiet city street whose residents raised concerns about possible disruption at the shelter. So far, no opposition to the latest proposal has surfaced, Schmersahl said.

The house, located in a residential area in the southeast end of the city, is divided into four apartments. The group plans to open the shelter in December, after the leases of tenants who live there have expired, Riley said.

The cith has offered to provide $70,000 for the new shelter, but last week the county commissioners rejected a request for $30,000 to help the purchase. The group intends to make another appeal for money, but the commission's action will not delay plans to buy the property, Riley said.

''I'm very disappointed. The county should provide funds because ''well over half our clients are from outside the city,'' she said.