WASHINGTON — The Supreme Court on Wednesday threw out a proposed class-action antitrust lawsuit against Comcast, the nation’s largest cable television company, in which a group of more than two million current and former Comcast subscribers sought to prove that the company had unfairly eliminated competition and overcharged customers.

In a 5-to-4 decision written by Justice Antonin Scalia, the court said that the proposed class of Comcast subscribers failed to meet formal legal guidelines for how to certify that evidence of wrongdoing was common to the group and that damages could be measured on a classwide, rather than an individual, basis.

The decision evoked a harsh dissent, however, written jointly by Justices Ruth Bader Ginsburg and Stephen G. Breyer, that accused the majority of focusing on an issue other than that on which the court had agreed to hear the case. They said the court should not have heard the case.

The majority created a ruling that “is good for this day and case only,” the dissenting justices wrote, and “sets forth a profoundly mistaken view of antitrust law.”