Dupuy, 38, turned in the fastest overall time of the day, completing a 525-yard swim, a 13.4-mile bicycle ride and a 3.1-mile run in 1 hour, 14 minutes and 24 seconds.
Gagnon, 47, was just over two minutes behind Dupuy in overall time, completing the three events in 1:16.43.
The triathlon drew a field of 17 individual competitors and seven three-member teams, in which each member competed in one of the three events.
In the team competition, the threesome of 9-year-old Quinlan Hinerfeld, Matt Gerrish, 44, and Doug Hinerfeld, 42, all of Bar Harbor won top mixed team honors and was the overall fastest with a combined time of 1:07.28.
Ellsworth’s Holmes trio — 12-year-old Camden, 13-year-old Kody and 45-year-old Eric — was the top male team with a combined time of 1:12.17.
Female team honors went to Kate Brenner, 20, Kiona Osterlin, 21, and Eliza Broughton, 22, all of Ellsworth, with a combined time of 1:23.42.
Age group winners and runners-up in the individual competition:
Girls ages 11-19 – Cedar Slagle, 15, of Blue Hill, first in 1:30.25; Ellie Hinerfeld, 13, of Bar Harbor, second in 1:35.27.
Boys ages 11-19 – Adam Graham, 18, of Surry in 1:39.22.
Women ages 20-29 – Katie Ford, 20, of Trenton in 1:53.51.
Women ages40-49 – Gagnon, first; Kathy Fleury, 47, of Winslow, second in 1:28.47.
Men ages 40-49 – Matthew Wilson, 40, of Hancock, first in 1:18.12; Jerome Lawther, 40, of Blue Hill, second in 1:25.50.
Men ages 60-69 – Chip Loring, 65, of Old Town in 1:25.40.
In separate events, Camden Holmes was the fastest swimmer in 6:50; Matt Gerrish was the fastest bicyclist in 36:54; and Doug Hinerfeld was the fastest runner in 21:43.