The movie opens with our hero Bart working on a black railroad crew. His white bosses are super racist and it's clear they put no value on a black person's life. The boss Taggart eventually sends Bart and a friend to check out some quicksand up ahead of the tracks they're laying, and Bart barely makes it out of the quicksand alive. So he decides to take out his frustrations by smashing Taggart in the back of the head with a shovel.
And yes, Brooks plays all of this for laughs. (Pretty amazing when you think of how violent it sounds when you just describe it as it happens.)
Later on, Taggart goes to meet with his boss, a government man named Hedley Lamarr. Hedley wants to make sure there are no delays with building his new railroad, so when he finds out about the quicksand, he tells Taggart to run the railroad through a town called Rock Ridge. Taggart agrees to round up his henchmen and attack the town, hoping to force the townsfolk out.
Unfortunately for Hedley Lamarr, the people of Rock Ridge are too stubborn to pack up and leave after the first attack (which has left their town sheriff dead). Hedley decides he'll break the town's spirit by sending them Bart—a black guy—as their new sheriff. The hicks of Rock Ridge don't take too kindly to this idea and they threaten to shoot Bart the moment they see him. But Bart uses his wits to outsmart them and to hide himself inside the town's sheriff's office.
In the sheriff's office, Bart meets a local drunk named Jim. Jim apparently used to be called The Waco Kid and he still has the quickest draw in the West. Jim becomes Bart's only friend in Rock Ridge, although Bart remains optimistic about his ability to win the town over.
Jim, on the other hand, ain't so optimistic.
When sending Bart fails to chase away the people of Rock Ridge, Taggart sends in his toughest goon, a monster named Mongo, to destroy the town. The townsfolk are so desperate that they come crawling back to Bart to beg for his help. Bart appreciates the irony of the situation, but he also does his job and uses an exploding box of candy to stop Mongo.
Why? Because it's a Mel Brooks movie.
Afterward, the people of the town are a little more willing to accept him. But they still won't speak to him in public.
After Mongo fails, Hedley sends a beautiful singer named Lili to seduce and destroy Bart. But the plan backfires when Lili falls in love with Bart and joins his side of the conflict. Hedley nearly loses his mind and decides to make one last effort to ruin the town. He and Taggart set to work on recruiting an army of the most vicious outlaws in all the Wild West.
Sheriff Bart finds out about Hedley Lamarr's army and gathers all of the people of Rock Ridge to tell them his plan. He has gotten the help of the local black railroad workers, and he plans on building an exact replica of the town of Rock Ridge that lies three miles east of the real town.
That way, Hedley Lamarr's army will attack the wrong place and all their efforts will be pointless. The plan works like a charm and Bart detonates some dynamite to throw the outlaw army into chaos. Then he and his buddies ride in to finish off the rest of Hedley's thugs.
In the movie's final scene, the battle between good guys and bad guys gets so out of control that it busts out of the set for Blazing Saddles and brings the fight onto other movie sets in the Warner Brothers' studios.
Eventually, Bart tracks down Hedley and shoots him in the groin. Bart ends the movie by riding off into the sunset with his buddy Jim. He'd like for us to think his work in Rock Ridge is done and he needs to go help other people. But the truth is that without an enemy, Rock Ridge is a super boring town and Bart can't wait to get away from its dumb, racist inhabitants.