Montgomery County Executive Charles W. Gilchrist banned South African wine from the shelves of the county's 21 liquor stores yesterday, hours after the president of the local NAACP chapter smashed three bottles of the wine to protest its sale.

"The racist policies of the government of South Africa are abhorrent to the people of this county," said Gilchrist, who ordered the county's liquor control department to remove 141 cases of South African Fleur du Cap wine, valued at nearly $6,000, from the stores, which the county operates, by 6 p.m.

Gilchrist's order, which will permit the county to sell the wine to the 576 restaurants, bars and wine shops it has licensed, came three hours after local black leaders called on him to order the removal.

Roscoe R. Nix, president of the Montgomery NAACP chapter, had smashed three bottles of white and rose' wine to dramatize the civil rights group's opposition to the sale.

"Taxpayers' dollars--my dollars--are being used to support one of the most unmerciful, murderous regimes in the world," declared Nix, who donned thick work gloves before breaking the bottles with a hammer in the press room of a county office building.

"We regard this wine as racially tainted," Nix said.

"Its purchase puts bread in the mouths of those who are oppressing native Africans."

South Africa has a longstanding policy of apartheid, or enforced separation of blacks and whites.

After being informed of Gilchrist's order, Nix said: "This will mollify many of our folk who are upset and angry about sale of the wine."

About 70 NAACP members voted at a regular chapter meeting recently to endorse a county ban on the South African wine, which was placed on sale in county stores in August.

Three kinds of Fleur du Cap wine were available at $3.45 a bottle. A fourth variety, a cabernet sauvignon, sold for $5.85. Eighteen cases of the wine were sold through the retail stores.

Gilchrist's order marked the third ban on the sale of an alcoholic beverage in four years.

In 1979, Gilchrist authorized a ban on the weekend special sales of Stolichnaya vodka following the Soviet invasion of Afghanistan.

Last month, Gilchrist banned the sale of Russian vodka to protest the Soviet downing of a South Korean airliner.