BERLIN—Austria’s populist presidential candidate Norbert Hofer said he opposes an anti-European Union campaign and wants a referendum on a membership in the bloc only as an ultima ratio, in comments that come as public support for an EU withdrawal has decreased over the past two months.

In an interview with Austrian daily “Presse” published Saturday, the candidate for the anti-immigrant, euroskeptical EU Freedom Party said it would be wrong to imply that he favored Austria leaving the bloc.

“I was not amused,” Mr. Hofer said after his opponent, the independent candidate Alexander Van der Bellen suggested over the past days he wanted Austria to withdraw from the EU just as the British people have said in a referendum in June.

“Without a doubt, it would be damaging for Austria to currently leave the EU,” he said, adding Austria should be actively involved in improving the EU.

Mr. Hofer hopes to become the first populist head of state in postwar Austria after the country’s Constitutional Court last week ordered a rerun of the runoffround of the country’s presidential election, which Mr. Van der Bellen won by a small margin.