The cyclist from Wanlockhead was on the B797 near Mennock at about 19:20 on Monday when the accident happened.
Police said no other vehicle was involved.
He was airlifted to the Queen Elizabeth University Hospital in Glasgow with a serious head injury.
A 22-year-old man is in a critical condition in hospital after falling from his bike on a rural road in southern Scotland.