If a judge is called 'corrupt' by a defendant outside court in front of the media, or if something more unambiguously libelous is said, can the judge sue the defendant?
"Corrupt" would almost certainly be a statement of opinion, so not actionable in the US. A lot more detail would be necessary for this to be defamation.
"Judge XXXX has taken millions in shadow bribes and has consistently ruled for the wishes of his/her benefactors. There has been a history of being reversed on appeal proving their bias. Also I watched them kick a puppy."
Then, obviously, these things would have to be false. Even then, the bar is pretty high. There are exceptions both ways on this, but as a general guideline, if the public knows a person's name (judge in a high profile case, for example) they are probably classified as a public figure. The rule there is one of "actual malice" which isn't exactly what it sounds like, but it's the highest bar for defamation cases.
The speaker would have to say something factually false, knowingly or with no regard for the truth. Giuliani, for one recent example, was found guilty of defaming the Georgia election workers, because he went into great detail about his false claims, and he was told repeatedly that thise claims were false, but he kept going.
“Corrupt” would almost certainly be a statement of opinion
How the fuck is "corrupt" a matter of opinion? Maybe it's different in English which is not my first language but corrupt has a very straightforward meaning, it means you took money or favors to affect your professional conduct.
In American English, "corrupt" can refer to both the crime of corruption (eg quid pro quo deals with public officials) as well as seemingly abuses of discretion. For example, a city engineer has some amount of discretion when designing a new street, whether to dedicate more public space to automobiles or to restrict the space to become more like a public plaza, ie a living street with places to sit, eat, shop, and take in the air.
By objective professional standards, either approach could be appropriate if properly justified. But public sentiment could result in that engineer being called "corrupt" because they're giving less favor toward automobiles, for example. That is, "corrupt" is an epithet to voice one's displeasure at a discretionary decision. Also see sports umpires, who face similar (or worse) vitriol.
Assuming OP is talking about Trump, this would take place in the USA. So because they are in the USA, they would also need to prove the things said were actually false, that the things said were said with malicious intent, and that what was said was not protected such as something protected by the first amendment.
Winning a defamation case is very, very hard in the USA. Its not like Japan where the law literally gives away wins because you don't even have to prove that what was said was false. The USA requires a lot of things be met in order to even qualify as defamation.
The short answer is "yes" if you define "suing" as filing a lawsuit with a court. Anyone can file a lawsuit in court for pretty much any reason. Whether or not it goes anywhere depends on the strength of the claim and other factors.
The longer answer is still "yes" if you narrow your definition of "suing" to filing a legitimate lawsuit with the potential to be successful. Judges are still people and can suffer real damage due to libelous or slanderous claims. There are certain elements that must be proven to be successful though. One of the defenses is for rhetorical hyperbole. As a hypothetical example, if a defendant with a penchant for grandiose and bombastic hyperbole and known for calling everything and everyone under the sun "corrupt" because he's a pathetic baby calls the judge corrupt, it would likely fail based on the comment being rhetorical hyperbole. It would be similar to saying someone "killed" another person when no actual murder took place and it was like a verbal smack down.
As with everything it depends. The judge can file but unless they can show they suffered loss because of the comment another judge would throw the case out due to lack of standing.