A quick-thinking 15-year-old girl outwitted the Uber driver who tried to kidnap her and take her to his Brooklyn home to sexually assault her — escaping his car and calling police, Newsday reported, citing charges by police and prosecutors.

The teen had been at a Sweet 16 party in Atlantic Beach, LI, on July 12, when driver Sean Williams was dispatched to pick her up and drive her to Merrick, LI.

Instead, Williams, 32, drove her to Brooklyn — but before he reached his home, the girl convinced him she needed a bathroom, cops said.

When Williams stopped at a McDonald’s on Linden Boulevard, she ran inside and called police.

Williams fled before they arrived, Nassau DA Madeline Singas said.

He was arrested four days later and charged with felony sexually-motivated kidnapping.

Williams’ lawyer, Steven Gaitman, said his client, who pleaded not guilty on Aug. 20, is “adamantly denying the charges,” the newspaper said.

Williams, who is free on a $150,000 bond, has a 4-year-old daughter.