NORTHAMPTON — The clock is ticking down to register to vote in next month’s state primary. The deadline is Friday.

The state primary will take place on Sept. 8, two months before the state and presidential elections. Voters wishing to cast ballots must be registered by 5 p.m. on Friday.

The primary will determine the candidates who will appear on the Election Day ballot, Nov. 8.

Contested local races include the Hampshire County Sheriff’s race and the  3rd Hampshire House of Representatives District, both of which feature retiring incumbents: Sheriff Robert J. Garvey and Rep. Ellen Story.

Although there are no positions for the U.S. Senate up for election this year, voters will decide nine seats in the U.S. House of Representatives, eight of which are uncontested for the primary.

In addition, voters will be electing candidates for a number of state offices, including the Governor’s Council, State Senate, State House of Representatives and a number of county offices.

According to state law, Massachusetts voters who are registered to one party cannot vote in any other party’s primary. However, unaffiliated voters (voters who have not declared for a party) may choose which primary they vote in.

The deadline also marks the last day voters can change their party affiliation before the primary.

Voters can register online at www.registertovotema.com/