Hamlin was born in Standish (Richville), Cumberland County, Maine, Hamlin attended the public schools, Gorham Normal School, and Bridgton Academy. He taught school and, in 1900, graduated from Bowdoin College in Brunswick, Maine. He served as superintendent of the South Portland and Cape Elizabeth schools from 1901-1925 and as city clerk of South Portland, Maine in 1913. He engaged in the real estate business at South Portland in 1925. He was also interested in farming. He served as member of the board of registration 1926-1932. He served as mayor in 1933 and 1934.
Hamlin was elected as a Democrat to the Seventy-fourth Congress (January 3, 1935 - January 3, 1937). He served as chairman of the Committee on Memorials (Seventy-fourth Congress). He was an unsuccessful candidate for reelection in 1936 to the Seventy-fifth Congress. He resumed the real estate business and farming in South Portland, Maine, until his death there July 27, 1939. He was interred in Hamlin Cemetery, Standish (Richville), Maine.