This is the case even if you know that the theater is not on fire and yell that you yelled that it was with bad intent.
There was one Supreme Court case (Schenck v. United States) where one Justice used this as an example of bad speech in a non-binding dictum, and it just stuck in popular culture. That case was bad law though (the court ruled that you can’t protest a war because it’s dangerous to the country by harming military recruiting) and it was later overturned.
While there is no federal or constitutional prohibition on this, there are some state laws that criminalize false reporting of emergencies, and if somebody gets injured or killed as a direct result of you yelling in bad faith that there is a fire in a theater, you could get prosecuted for that similar to fighting words.