First granted in 1769 by Governor John Wentworth, the town was named for William Petty Fitzmaurice, Earl of Shelburne. He was a supporter of independence for the American colonies, and at his insistence, King George III recognized the independence of the United States. The town was first settled in 1771, and incorporated on December 13, 1820, when Shelburne voters chose to keep the name. It included Shelburne Addition until that was set off and incorporated in 1836 as Gorham.

On August 3, 1781, the town was attacked by a party of six Indians, who had earlier raided Bethel and Gilead, Maine. They killed one man and took another into captivity. The rest of the inhabitants fled to Hark Hill, where they spent the night before sheltering in Fryeburg.