Dewey was elected as a Federalist to the Thirteenth Congress and served from March 4, 1813, until February 24, 1814, when he resigned, having been assigned to a judicial position. He was appointed by Governor Caleb Strong an associate judge of the Massachusetts Supreme Judicial Court on February 24, 1814, and served until his death in Williamstown, Massachusetts, May 26, 1815.
He was interred in West Lawn Cemetery.