A local ordinance encouraging residents to own guns was upheld by voters today, ending a three-month controversy that had divided this rural Vermont community.

''The first thing that Communists do is to make guns unlawful under penalty of death,'' a retired worker, Alfred Smith, warned his neighbors before the 201-to-90 vote supporting the ordinance. ''If anyone doesn't see the need for this ordinance then their sight isn't very good.''

Opponents had hoped their campaign would bring out enough of the town's 2,250 voters to defeat the ordinance at the special election.