This is one of numerous occasions where Scooby, Shaggy, and/or the rest of Mystery Inc., have encountered Headless Horsemen in the vein of Washington Irving's 1819 story The Legend of Sleepy Hollow.
The story of the Headless Horseman comes from The Legend of Sleepy Hollow by Washington Irving. It is actually based on real events and people and is not just a made up ghost story. The story told by Beth in the episode actually does involve the events that inspired the story Irving wrote.