Most agree that the events of the short story "The Legend of Sleepy Hollow" take place in the year 1790, thirty years prior to the publication of the story in 1820.
The earlier date explains the pervasive belief in spirits and ghosts that are such an integral part of the story. Since "The Enlightenment" (1685 to 1815) was still incomplete in 1790, the superstitions that make the story work would have been commonplace - a situation more unlikely in 1820 when the story was actually written.
It is impossible to ascertain the exact year in which "The Legend of Sleepy Hollow" takes places since the author Washington Irving does not indicate this in his narrative. As he did with his tale "Rip van Winkle," Irving suggests his story was found among the papers of the late Diedrich Knickerbocker, who was curious about the Dutch history of New York, but he is an eccentric character of Irving's invention. In the preface to another of these stories, "Rip Van Winkle", Irving refers to the Dutch governor of New Netherlands, Peter Stuyvesant, who was in office from 1646-1664.
Interestingly, Irving's choice of name for his main character was discovered while he was an aide-de-camp to Governor Daniel Tompkins. While he was staying at Fort Pike in 1814, Irving met Major Ichabod Crane.
…that splendid name, just the sound of it evoking images of a gangly Yankee schoolmaster, apparently stuck in Irving’s mind.
Now, in the narrative "The Legend of Sleepy Hollow," Irving does write this:
...in such little retired Dutch valleys....In this by-place of nature [Sleepy Hollow] there abode, in a remote period of American history, that is to say, some thirty years hence...Ichabod Crane...as he expressed it, "tarried" in Sleepy Hollow.
Also, the Headless Horseman is said to be
...a Hessian soldier from the Revolutionary War, beheaded by a cannonball in some unnamed battle....
So, the tale must take place after the Revolutionary War which ended in 1783. Since the narrator says "thirty years hence," perhaps the setting is 1813+, about the time that Irving discovered Major Crane. By the way, "The Legend of Sleepy Hollow" was written in 1819.