U.S. District Court Judge James Donato granted Twitter's motion to dismiss the lawsuit on Friday.
Danto is allowing lawyers for Trump to file an amended complaint that is "consistent with this order" by May 27, and added that it cannot contain any new claims or defendants without prior permission from the court.
The lawsuit alleged that Twitter violated the First Amendment of the United States Constitution, claimed that Section 230 of the Communications Decency Act is unconstitutional, and also alleged that Twitter used "deceptive and misleading practices" that are in violation of the Florida Deceptive and Unfair Trade Practices Act.
Donato wrote in his order that the First Amendment doesn't apply to private companies, adding that Trump is "not starting from a position of strength."
Twitter banned Trump in January 2021 and alleged that he contributed to the violence that took place at the Capitol on Jan. 6.
The lawsuit was originally filed in the United States District Court for the Southern District of Florida before being transferred.
Fox News' Tyler Olson contributed to this report.