Delegates at the Democratic Socialists of America national convention in Chicago vote on a resolution Friday. (Scott Heins)

— After Democratic Socialists of America became the largest socialist organization since World War II, its members broke into song. As Marcus Barnett, an organizer for Britain’s left-wing Momentum campaign, stood up to address the DSA’s biggest-ever convention Saturday, many of the nearly 700 delegates stood up and belted out the name of the Labour Party’s unapologetic leftist leader.

“Oh, Jeremy Corbyn! Oh, Jeremy Corbyn!” they sang, to the melody of the White Stripes’ “Seven Nation Army.” Bennett raised his fist in the air and sang along, dazzled that a British soccer chant had traveled all the way to Chicago.

“We got our Bernie,” he said, referring to Corbyn and Sen. Bernie Sanders (I-Vt.). “Don’t give up hope. Your time is coming now.”

DSA, founded in 1982 to create a political foothold for Marxists, has transformed into an ambitious left-wing force. Membership grew during Sanders’s presidential campaign, and then started surging the day after Donald Trump was elected president in what some DSA members jokingly call the “socialist baby boom.”

The DSA went from 8,000 members in 2015, the year its delegates endorsed Sanders for president, to about 25,000 in 2017, with chapters or branches in 49 states. Its platform calls for a worker-owned economy and the end of traditional capitalism.

“You are the antidote to total isolation of living under capitalism,” said Maria Svart, the national director of DSA, as the convention began. “It’s the job of organizers to build institutions that will be capable of absorbing masses of people and keeping them in motion.”

Although the group endorsed him, Sanders, whose campaign and lasting popularity changed public perceptions of socialism, has not been closely involved with the newly booming DSA. In a recent interview with The Post, Sanders suggested that the organization’s growth was one of many examples of how younger voters were rejecting the post-Reagan political consensus.

“Many young people understand that health care for all, making public colleges free, decent wages and affordable housing are all part of a democratic socialist program,” Sanders said.

The average age of DSA members has since 2015 dropped from 64 to about 30, according to an organizer. A May 2016 Gallup poll, conducted after most of the Democratic primaries, found just that 35 percent of Americans viewed socialism favorably. Among voters under 30, that number rose to 55 percent.

The youth of the DSA’s new membership has infused it with humor, irony and a dizzy confidence — much of it inspired by left-wing parties in Europe and South America. But on Saturday, after a short debate, DSA delegates voted to end their 35-year relationship with the Socialist International, the global network of left-wing parties.

Instead of seeking out stars, DSA members have focused on ultra-local campaigning. They joined sit-ins and protests against the Republican effort to repeal the Affordable Care Act, but they used them to advance arguments for single-payer health care similar to Canada’s. In California, DSA members have phone-banked and knocked on doors to back a state single-payer bill that the legislature’s Democratic supermajority has tabled; the campaign, however, is designed to continue even if the bill were to pass.

“You pick campaigns to engage in that will help people and build power for working people, but also set us up for more transformative work down the road,” explained Jared Abbott, an outgoing member of DSA’s national political committee. “There’s agreement about flexing independent, socialist electoral power in some kind of way, but people are being flexible about how to do it.”

In Chicago, DSA energy had been channeled through Carlos Rosa, a Democratic alderman who joined DSA after endorsing the Sanders campaign and helping it win heavily Latino wards. In Atlanta, Seattle and New York, there were more socialist candidates seeking office as Democrats or as third-party candidates in safe seats.

It would take years, Rosa said, to elect a critical mass of socialists; in 2019, he hoped to see at least five of them on Chicago’s 50-member city council. In the meantime, constant organizing and doorstep conversations would break the taboos voters still had about socialism.

“You explain what you stand for, and then you explain that this is democratic socialism,” Rosa said. “That’s how you overcome years and years of red-baiting.”

But a lack of “red-baiting” has been among the biggest surprises of DSA’s growth. In 2009, the tea party movement and conservative media, in tandem, condemned the Obama administration’s agenda as socialism at best and fascism — government intermingling itself with corporations — at worst. Frances Fox Piven, a former DSA board member, found herself at the center of Glenn Beck’s chalkboards as the radio and TV host explained how Obama’s stimulus and health-care policies would fulfill a long-term socialist plot to overthrow capitalism.

The DSA itself played a role in the panic. In his book “Radical-in-Chief,” National Review’s Stanley Kurtz pored over Obama’s memoirs and the records of DSA in New York to prove that the future president had attended at least one socialist conference.

Largely out of the spotlight, DSA members were instead building their own ironic media universe. Editors and writers for Jacobin, a socialist magazine whose growth also surged with the rise of Sanders, flitted around the convention as celebrities; so did co-hosts of the Chapo Trap House podcast, whose success had inspired a smaller podcast called the Discourse Collective.

The tone of the new socialist media can often be relentlessly ironic, surrealist and rude. Rather than policing it, DSA has embraced it. Christian Bowe, social media director for DSA, who tweets under the handle “Larry Website,” celebrated the 25,000th DSA membership by asking socialists to come up with terrible, garish memes. They obliged, with images of Shrek, Sonic the Hedgehog and legally embattled former Subway spokesman Jared Fogle commemorating the left’s new milestone.

“[Italian Communist Antonio] Gramsci proposed creating our own working-class culture which address our needs and vision,” he explained. “Memes are a snapshot of that; podcasts and publications like Jacobin and Current Affairs are extensions of it.”

All of it, after all, had led to a three-day conference during which nearly 1,000 delegates, observers and other DSA members approved a platform and elected leaders. On Saturday night, hundreds of them celebrated at the offices of the left-wing magazine In These Times, where free copies of Jacobin were distributed at the door.

A DJ dropped “Seven Nation Army” into the middle of a pop and hip-hop playlist, and the “Oh, Jeremy Corbyn” chant echoed through the hallways, which were marked by signs that quoted Karl Marx to make an important party announcement.

“From each according to their ability, to each according to their needs,” they read. “Please donate to ensure that everyone who needs a drink gets one.”