A conservative Australian politician who criticised a “Do it in a dress” school fundraiser as a “gender morphing” event has inadvertently helped the school raise almost $250,000 for girls’ education in Africa.

As part of an annual fundraiser, Craigburn primary school asked students and teachers to wear a dress or casual clothes on Friday, and donate a dollar or two. The school originally aimed to raise $900.

But then Cory Bernardi, an outspoken and deeply conservative senator from South Australia, took to Twitter about it, posting a link and commenting: “One school in SA now has ‘wear a dress day’. This gender morphing is really getting absurd.”

His tweet was quickly picked up and criticised, notably by Australian comedian Josh Thomas, who accused Bernardi of “purposefully misrepresenting the intent” of the students and their charity drive. Thomas donated $2,000 of his own money to the school and urged others to do the same.

By Saturday afternoon the school had received $246,000, making it the largest single day for donations in the charity’s six-year history. Many of the listed donations were dedicated to Bernardi.

“On behalf of our good friend, Cory Bernadi!” said one.

“A classic own goal. So good to hear there are now many other schools also signing up. Go for it, kids!” said another.

One commenter, Rose Hill, congratulated the students on their successful fundraiser. “I would never have known about your marvellous initiative without the free national publicity from Mr Bernardi,” she wrote. “Have a fun day dressing up for the cause.”

Australia is in the midst of a divisive and hostile debate over allowing same sex marriage, and Bernardi is a strident voice for the no campaign. He frequently speaks out against same-sex marriage, an anti-bullying program for schools to assist LGBT students, and other pushes for LGBT rights.

[$200,000] will now send hundreds and hundreds of girls to school with everything that they need. Morgan Koegel, One Girl charity

The senator, who now leads his own Australian Conservatives party, was formerly in the governing Coalition but quit in February. In 2012 he was resigned from his role as shadow parliamentary secretary to then opposition leader Tony Abbott after linking homosexuality to bestiality, a comparison he drew again in 2013.

After a successful week of fundraising and politics, it's time for a cold beer on a beautiful day. #auspol pic.twitter.com/nIS4zvAyka — Cory Bernardi (@corybernardi) September 22, 2017

On Friday he Tweeted a photo of himself with the caption “after a successful week of fundraising and politics, it’s time for a cold beer on a beautiful day”.

It was unclear whether he was referring to the incident, but many Twitter users intrepreted it as a reference to the incident.

“Craigburn Primary School can not thank you enough for your help. Well done big fella,” said one user.

On Friday, Morgan Koegel, the chief executive of the One Girl charity which runs the Do it in a dress campaign, said the incident “started as a negative but honestly I am feeling really positive about it.”

“Over the last 24 hours we’ve seen such an outpouring of support that it’s impossible not to have a smile on your face,” Koegel said. “$900 would have educated three girls for a year … [$200,000] will now send hundreds and hundreds of girls to school with everything that they need.”

The One Girl website saw a 5,000% increase in traffic on Thursday, and crashed about half a dozen times.

The campaign has run annually for six years, with a growing number of schools taking part. It has nothing to do with the marriage equality debate or gender identity, and is based on the school dress being a symbol of empowerment in developing countries.

Last year Do it in a dress raised $800,000. Participants can style and hold their own events, which might involve a mufti day, like Craigburn school, or taking on physical challenges while wearing a dress.

“The idea behind Do it in a dress is simple,” said Koegel. “In these countries a school dress is quite rare, only one in five have the opportunity to go to high school. So a girl is more likely to be sexually assaulted than go to school, or more likely be a child bride than go to school. So in these countries a girl’s uniform is a symbol of opportunity and empowerment.”

Koegel said the charity drive had “accidentally” been caught up in the marriage equality debate.

After media attention on Craigburn school’s fundraising, News Corp national newspaper the Australian reported it as being “hijacked by same-sex marriage activists on both sides of the debate”.

“It’s more a case of lack of research than a hijacking,” said Koegel. “This campaign has been running for many years. Our single mission is to educate one million girls across Africa. We have nothing to do with Australian politics.”