The ruling does not affect a separate lawsuit over hush money she says she was paid by Mr Trump's lawyer.
The judge also ruled that Daniels should pay Trump's legal fees.
The tweet was deleted shortly after it was posted, according to The Contemptor.
"In the kind of unrestrained tweet which has come to define the president's leadership - including the misspelling of Daniels' name - the United States president wrote on Tuesday: "'Federal Judge throws out Stormy Danials lawsuit versus Trump.
Donald Trump called referred to Stormy Daniels as "horseface" in a tweet that mentioned Fox News and saw him refer to Michael Avenatti as a "3rd rate lawyer". She is arguing that the agreement is invalid because he never signed it, and that claim is still in proceedings.
The exchange follows a failed defamation suit against Trump by adult film star Daniels - real name Stephanie Clifford - who claims to have had an affair with the 72-year-old then-business-tycoon in 2006. Bring everything you have, because we are going to demonstrate to the world what a complete shyster and liar you are.
Her decision to release the results was criticised by the Cherokee Nation, which said such exams are useless in determining tribal citizenship.
Trump has long mocked her assertion to have Native American blood, latching on to a disproven theory that Warren used her tribal heritage claim to advance an academic career at Harvard University.
The statement, which Daniels has since withdrawn, contradicted an extensive account of the alleged liaison she gave in a 2011 interview with In Touch magazine. Daniels wrote. "And perhaps a penchant for bestiality". He said he made the payments at Mr Trump's request.
Trump tweeted that the man was "nonexistent" and that Daniels was playing the "fake news media for fools".
Among the things she has discussed are her knowledge about intimate details of the now-president, to which she alluded again on Tuesday. Their other suit against Trump, over a nondisclosure agreement Daniels signed in 2016, remains pending before Otero.
"Only Rosie O'Donnell", he replied.