A group from Topsham arrived in 1776 to explore the area and lay out a town, called Plantation No. 1 or Sandy River Plantation, but permanent settlement was delayed by the Revolutionary War.
In 1781, the first settlers arrived, the same year a sawmill was established. On February 1, 1794, Sandy River Plantation was incorporated as Farmington, named for its unusually fertile soil. Beginning with a cluster of log houses at Farmington Falls, the town grew quickly and prospered. Agriculture was an important early occupation, with hay a principal product. Orchards yielded apples and other fruit. Farmington became one of the largest wool producing towns in New England, with many herds of sheep grazing the hills and intervales.
The town's water power attracted industry, including five lumber mills, two sash, blind and door factories, two brickyards, a foundry, a rake factory, three gristmills, nearly a dozen carriage factories, a cheese factory, two corn canning factories, two reaper machine factories, a spool factory and a tannery. As a regional center for manufacturing, trade and agriculture, Farmington was designated county seat when Franklin County was formed in 1838. In 1859, the Androscoggin Railroad completed its line from Leeds Junction to Farmington, carrying freight and tourists.
In 1879, the town became the southern terminus for the narrow gauge Sandy River Railroad (later part of the Sandy River and Rangeley Lakes Railroad), making it a gateway to the Rangeley Lake and Sugarloaf Mountain areas. Farmington suffered a devastating fire on October 22, 1886, when thirty-three houses, nineteen stores, three churches, the county jail and the post office were destroyed. The 1877 Methodist Church designed by noted architect Arthur H. Vinal survived. Farmington is today a college town and resort area.
Typical for Maine, Farmington has a humid continental climate (Köppen Dfb) with cold (sometimes severely cold) winters and warm, often humid summers. Winters are cold and snowy, with forty nights per year under 0 °F or −17.8 °C and 68.6 days failing to top freezing. Snow cover peaks in February at typically around 18 inches or 0.46 metres, but the maximum reached is 84 inches or 2.13 metres on February 28, 1969. The coldest month since records began in 1893 was January 1982, with an average of 3.4 °F or −15.9 °C, and the hottest was July 1921, with an average of 73.3 °F or 22.9 °C, including 12 days over 90 °F or 32.2 °C, while the coldest winter was that of 1917–1918, with an average temperature of 10.45 °F or −12.0 °C. The hottest day was August 3, 1975, which reached 101 °F or 38.3 °C, while the coldest temperature was −39 °F or −39.4 °C on January 20, 1994.
Precipitation is abundant throughout the year, with snowfall especially heavy in winter. The wettest calendar month was December 1969, with 15.49 inches or 393.4 millimetres including 41.0 inches (1.04 m) of snow and a fall from a warm front of 9.97 inches or 253.2 millimetres of precipitation (mostly rain) on December 27 and 28. The snowiest season was from July 1968 to June 1969, with total snowfall of 164.0 inches or 4.17 metres, while the least snowy was from July 1980 to June 1981, with 43.0 inches or 1.09 metres.
Farmington is the subject of a prophecy by the Quaker Licia Kuenning (formerly Lisa Bieberman) about a Coming New Order in the town. This was originally prophesied for Tuesday, June 6, 2006 but, after gathering more than 80 people together with no apparent miracles on that date, is now prophesied "within the next few years".
Farmington is home to The University of Maine at Farmington, part of Maine's public university system. UMF had a full-time enrollment of 1,800 in 2016.