A U.S. judge threw out Elon Musks lawsuit against a nonprofit group that faulted him for allowing a rise in hate speech on his social media platform X, formerly Twitter.