Alexander F. Muir, goat farmer and retired U.S. engineer, still isn't sure he's the man for the job, but when his name was pulled from a punchbowl yesterday in the Loudoun County Courthouse he became the new mayor of Hillsboro, population 125.

The special drawing took place after the 61-year-old Muir, an unannounced write-in candidate, and three-term Mayor Byron Farwell won 17 votes each in Tuesday's election. Thirty-five of Hillsboro's 67 registered voters cast ballots, but one expressed no preference.

"I'm not really in politics," Muir said after his serendipitous victory. "I sort of wish Byron had won, but I'll do the best job I can."

Farwell, a 60-year-old historian and biographer, was apparently the victim of voters who believed he had paid too much attention to his writing and not enough to them.

"What the town needs is a mayor who'll get out of the house and go see his neighbors once in a while--they're the ones who put him in there," said J.A. Wright, an 84-year-old storekeeper. Wright said he has never voted, but that he did once make a bet that Franklin D. Roosevelt would win.

Hillsboro, which claims to be the smallest town in Virginia, overlooks North Fork Catoctin Creek in the Blue Ridge foothills of western Loudoun County. The major function of its $50-a-year mayor, its five $25-a-year Town Council members and its three water commissioners is to oversee the town's prize water system, which pipes unlimited mountain water from the town spring to each household for $24 a year.

"He Farwell believes in leaving it up to the water commissioners," said postal clerk Charlotte James. "But if the water commissioner is out of town when a pipe breaks, this little town believes the mayor should be out there digging the holes."

James works in a tiny red post office where residents come to pick up their mail each day. The town office upstairs, with a rifle on the wall and a few law books on one shelf, was too small for a voting machine, so townspeople voted in the stone schoolhouse down the street.

The write-in campaign, organized by a few women known for keeping themselves and others well-informed on town news, took Farwell by surprise. Last week, the Loudoun Times-Mirror reported that he was running unopposed, and even Muir said he had no idea he would receive more than three or four votes.

"If both candidates had been up front about this thing and people had known there was a contest, I think the results would have been quite different," said Farwell, who wears a gray beard and speaks with a resounding voice. He acknowledged that he did not fit everyone's image of the ideal mayor: "Because I don't practice a trade or profession they can understand, this provokes some suspicion, I suppose."

Farwell said he also may have alienated some voters when he moved the town's $30,000 nest egg from a passbook savings account in Round Hill into Treasury bills. "This shook people up," Farwell said. "This seemed like a very radical move."

Muir, a soft-spoken man who raises prize Nubian goats, concealed any elation he might have felt when registrar Jo Anne Bodner picked the envelope containing his name. "I had no idea," Muir said of the write-in campaign. "I didn't encourage them at all."