WASHINGTON—A federal judge on Monday dismissed antitrust lawsuits the federal government and most states filed against Facebook Inc., a major win for the company before the cases barely got off the ground.

U.S. District Judge James Boasberg in Washington granted the social-media giant’s requests to dismiss lawsuits filed by the Federal Trade Commission and state attorneys general in December.

Judge Boasberg said the FTC’s lawsuit was “legally insufficient” because it didn’t plead enough allegations to support monopolization claims against Facebook. The judge, however, said the commission can try again and gave it 30 days to attempt to file an amended lawsuit.

The judge dismissed the states’ case in its entirety, largely on the grounds that the attorneys general waited too long to bring their claims.

(More to come)

Write to Brent Kendall at brent.kendall@wsj.com