Town officials from Upper Marlboro, who have restricted voter registration to four hours every two years, have agreed to a court order that calls for allowing residents to register during normal town office hours and at all town meetings.

They signed a consent decree Monday, to take effect in 30 days, that also orders the town's three commissioners, after voting behind closed doors last summer, to vote again on its 1982-83 budget.

Circuit Judge Perry G. Bowen Jr. of Calvert County also ordered the town to pay the $395 legal costs of the citizens who brought suit against the town and two of its three commissioners last summer.

The defendants, chief commissioner Helen Wilson and commissioner Ruth Buck, also were ordered to give a set of keys to town files to fellow commissioner Jeff Smith, who was one of the plaintiffs. Smith, elected in January 1982, was often at odds with Wilson and Buck and said he was refused access to town police documents.

"We have a victory," declared Deborah Brown, who said she has not been able to vote in the seven years she has lived in the town. "In 1776, the people of the United States got the right to vote; in 1983, the people of Upper Marlboro did."

Ralph Powers, an Upper Marlboro attorney who represented Wilson, Buck and the town, described the decree as "a series of concessions" that should end the long controversy. He said Wilson and Buck were satisfied with the agreement: "They wouldn't have signed this if they weren't pleased."

Many town residents complained that if they could not register during the four-hour period immediately preceeding the elections every two years, they were unable to vote at all. Wilson often would telephone many of the town's 320 residents as the four-hour registration period came to an end, reminding them to register.

Smith, a lawyer and town resident for almost five years, said the court order will add about 50 people to the 105 registered to vote.

But he said he probably will not run for office next January. "It's a grief I do not need," he said.