Only those who have “standing” – the legal authority to sue – can file a lawsuit.
For immigration applications that have a petitioning sponsor and a beneficiary, the petitioner always has standing to sue. Numerous courts have held that beneficiaries also have standing to sue, but that is not universal.
The best practice is have both petitioner and beneficiary named as plaintiffs. Petitioners are sometime reluctant to sue because they don’t want the publicity. Because case names are frequently made up of the first named plaintiff “versus” the first named defendant, a reluctant petitioner can sometimes be persuaded to join a lawsuit if they are the second listed plaintiff. Failing that, cases can and are brought with just the beneficiary as the plaintiff. But this approach carries some additional risk.