Philly DA Larry Krasner had sued Musk calling the giveaways in swing state Pennsylvania an illegal lottery.
-Ted Johnson contributed to this report.
The case pertained only to Pennsylvania, whose 19 electoral votes are key to next weeks contest.
Elon Musk speaks at Donald Trump rally in PennsylvaniaGetty
Krasner had insisted in his suit that the issue is clearly under local jurisdiction.
His lawyers filed a motion of removal in federal court late Wednesday night.
The decision today likely means the SpaceX founder can continue the cash gifts through the election next Tuesday.
America PACs and Musks illegal lottery scheme also violates the Commonwealths consumer protection laws.