Spike Lee is doing the real-estate thing.

The filmmaker and his wife, Tonya Lewis Lee, are selling their historic town house — known as the Hatch House — on East 63rd Street for $32 million, The Post has learned.

Lee’s storied Upper East Side landmarked mansion has an unrivaled list of famous former owners, including the artist Jasper Johns, from whom he bought the place in 1998 for $16.6 million.

It is a sprawling 8,292-square-foot, 32-foot wide home divided in two by a stunning internal courtyard with a fountain.

Other past owners include famed burlesque stripper Gypsy Rose Lee, who was known to host wild parties there.

The mansion’s history dates to 1916, when stables at the location were sold for $85,000 to the family of William K. Vanderbilt as a wedding gift for his daughter Barbara C. Rutherford.

The design, by Frederick J. Sterner — known for renovating, not building, town houses — was a modern Spanish Revival style that was unusual for the time.

The next owner was hot-shot Broadway producer and agent Charles B. Dillingham, who bought the home in 1921. He owned the Globe Theatre and was partners with Flo Ziegfeld and A.L. Eralanger. He lived there, grandly entertaining with his second wife, until their divorce in 1924.

Next up was Charles Lanier Lawrance, an aeronautical engineer who merged his company with the Wright Brothers after World War I, and created an engine that powered Adm. Richard Byrd’s North Pole explorations and Amelia Earhart’s historic flights.

Gypsy Rose Lee owned the mansion for three decades until her death in 1970. Dr. Ferrucio di Cori then bought it before selling to Johns.

Besides his $32 million mansion, Lee owns a two-acre estate in Martha’s Vineyard and a three-story Fort Greene property that is his film-production company’s headquarters.

The current listing brokers, Serena Boardman and Eva J. Mohr of Sotheby’s International Realty, declined to comment.