American Ledecky, 19, took nearly two seconds off her own world record to win in eight minutes 4.79 seconds, nearly 12 seconds clear of the rest.
Carlin, 25, was her nearest challenger, securing her second silver of the Games having finished second in the 400m freestyle earlier in the week.
Hungary's Boglarka Kapas took bronze.
Ledecky's dominant display rounded off a stunning debut Olympics with a world record nearly 14 seconds faster than what it stood at when Rebecca Adlington set it at the Beijing Olympics.
Ledecky said, "I had a lot of fun tonight." "I just wanted to push myself and see what I could do."
Carlin secured Britain's fifth Rio swimming medal, with her two silvers complemented by two more from Siobhan-Marie O'Connor in the 200m individual medley and the men's team in the 4x200m freestyle relay, and Adam Peaty's 100m breaststroke gold.
Carlin said after the race, "I couldn't do it without my family." "They have been there through the tough times and it is nice that they can be here.
"Two silver medals, it is an incredible feeling. I'm finally believing in myself and stick to the race plan..."