Dude ranches near Yellowstone, by which gate you use
Everyone says near Yellowstone. The park has five entrances and they are hours apart, so the useful question is which gate your ranch is on.

Why the gate matters more than the mileage
Yellowstone is bigger than Rhode Island and Delaware together, with five entrances spread around its edge. Two ranches can both sit 40 miles from the park and be a five-hour drive apart, because getting between gates means going around the outside.
So the honest version of this list is not a distance ranking. It is which entrance each ranch is on, because that decides what you can see in a day trip and how long you spend in the car.
North gate: Paradise Valley and the Gallatin
The north entrance at Gardiner is the only one open to cars all year, and it is the closest thing to a front door. Mountain Sky sits about 23 map miles from it in Paradise Valley, the shortest run of any ranch here. Lone Mountain is about 31 at Big Sky, and Nine Quarter Circle and Elkhorn Ranch are both about 46 up the Gallatin.
This is also the Bozeman side, so it is the easiest group to fly to. Lone Mountain is about 40 minutes from the airport, and Elkhorn charges $250 each way for up to five people.
On Brand Book: Mountain Sky Guest Ranch, Lone Mountain Ranch, Nine Quarter Circle Ranch, Elkhorn Ranch
South gate: Jackson Hole and Dubois
The south entrance runs straight out of Grand Teton National Park, so these ranches give you two parks from one base. Lost Creek and Triangle X are both about 33 map miles out at Moose, and Red Rock about 36 at Kelly. Triangle X is the unusual one: it is inside Grand Teton National Park, not merely near it.
Over Togwotee Pass, the three Dubois ranches sit about 66 miles from the same gate. Bitterroot, CM Ranch and Lazy L&B are a longer drive but a quieter valley, and Lazy L&B sits at 7,200 feet.
On Brand Book: Lost Creek Ranch, Triangle X Ranch, Red Rock Ranch, Bitterroot Ranch, CM Ranch, Lazy L&B Ranch
Northeast gate: the Beartooth side
The Cooke City entrance is the quiet one, reached over the Beartooth Highway, which closes with the snow. The ranches on this side are mostly working outfits rather than park bases. Paintbrush Adventures is about 42 map miles out at Absarokee, Lonesome Spur about 53 at Bridger, and Sweet Grass about 56 at Big Timber. Dryhead is about 83, down in the canyon country.
If you came for cattle rather than geysers, this is the side to look at: three of those four put guests in real ranch work.
On Brand Book: Paintbrush Adventures (Barron Ranch), Lonesome Spur Guest Ranch, Sweet Grass Ranch, Dryhead Ranch
Near the park is not a day in the park
A ranch week is a full schedule. Most of these ranches ride mornings and afternoons, and the ones that run a park trip treat it as an off-ranch outing on a set day, not something you do whenever you like. Sweet Grass, for instance, lists Yellowstone day trips as a separate extra rather than part of the week.
If seeing the park is the point of the trip, say so when you book and ask which day it happens. If riding is the point, the park is a bonus and the gate matters less than it looks.
On Brand Book: Sweet Grass Ranch
One last thing
The mileages here are straight-line distances from the ranch's nearest listed town to the gate, measured off the map. Mountain roads are longer than that, sometimes much longer, and passes close in winter. Every ranch page here lists the nearest airport and what the ranch charges to collect you, which is the number that actually decides your travel day.