Republican T. Farrell Egge won a narrow victory yesterday in the fiercely contested race for a vacancy on the Fairfax County Board of Supervisors, giving the GOP control of the county board for the first time in more than a century.

Boosted by a Reagan sweep of the county, Egge sustained a slim lead over Democrat Gerald W. Hyland and bulldozed independent candidate Gerald A. Fill, who was accused of playing the spoiler in the contest for the Mount Vernon District seat.

Unofficial returns showed Egge with 12,548 votes, Hyland with 11,589 and Fill with 2,566. The tally did not include absentee ballots, which election officials expect to total by today.

Democrats and Republicans considered the Mount Vernon race one of the most important in recent years. The outcome loosened the Democrats' longstanding hold on the nine-member Board of Supervisors and gave Republicans control over appointments to dozens of county commissions and authorities. Some Republicans predicted the victory would help cement growing Republican control of the wealthy suburban county.

"This a Republican county -- we'll see that over the long haul," said Republican Supervisor Thomas M. Davis, who contributed heavily to Egge's campaign in what has been considered a swing district. "I don't think the Republicans will lose this seat on the board for a long time."

But Egge, a lawyer making his second attempt to gain a seat on the county board, conceded that the slim margin of victory indicated there may be no overriding mandate for change in the district: "With it as close as this, I don't know how hard we can come down on that."

Both major party candidates accused Fill, a county School Board member, of siphoning votes from their columns. A dejected Fill blamed his poor showing of about 10 percent of the total vote on a race in which "party ruled over issues and substance."

"Fill's presence had an impact," said Hyland, who conceded the race before the results were announced. "The combination of Reagan and Fill spelled defeat for us."

Democrat Martha V. Pennino, vice chairman of the county board, said, "It's pretty depressing; it seems like the Democrats are on the decline." Pennino said she was planning to attend the play "Cats" during the vote counting yesterday because "I don't want to be around for the tears."

The Mount Vernon district, once heavily Democratic, has become a swing district in recent elections. The supervisor's seat was opened to a strong Republican challenge when Democratic member Sandra L. Duckworth unexpectedly stepped down this year after serving only one year of her second four-year term.

With the political power balance of the county hinging on the race, the traditional issues of transportation problems, taxes and education were dwarfed by partisan considerations.

The campaigns of both parties and the independent candidate were thrown together hastily because of Duckworth's unexpected resignation this summer. She angered many Democratic Party officials when, after first deciding to remain in the job until January, she changed her mind and decided to resign in August to join her husband in Honolulu, where he was recently named director of a prestigious museum. Had she remained on the board until next year, her seat would not have been on the ballot until a special election was called.

With an open race, the major parties dumped thousands of dollars into the campaign. Reports filed eight days prior to the election showed that Egge had raised $46,613, topping the $28,239 collected by Hyland. Fill was a distant third with $5,147 in contributions and with debts more than double that amount.

During the tumultuous 10-week campaign, candidate forums frequently exploded into personal attacks. Hyland, 48, who has served on the County Board of Zoning Appeals and Human Rights Commission, and Fill, 46, accused Egge of lacking a record of service to the county because he has not held public office. Egge, 42, countered, saying: "These men are part of the problem" of an unresponsive government.

The final weeks of the campaign also were dominated by vocal concerns of the heavily Republican Fort Hunt High School area over proposals by a School Board task force to transform the high school into an intermediate school.

All three candidates raced to show their support for keeping the high school open, with each trying to prove that their election would help preserve the school, even though the matter is before the School Board -- not the Board of Supervisors.