Argentina and Barcelona footballer Lionel Messi and his father will appear in court on Friday to face charges of tax fraud.

Messi and and his father, Jorge, are accused of evading €4.2m (£3.4m) in tax on earnings made from endorsements from his principal sponsors – Adidas, PepsiCo and Proctor & Gamble – and a number of other companies.

The prosecution alleges that they set up shell companies in Uruguay and Belize to avoid paying tax in Spain. Both men deny the charges, saying the deals were done by Messi's former agent without their knowledge. The alleged crimes took place between 2007 and 2009.

Messi, voted world player of the year four times, and his father will be questioned in a closed session in a court in Gava, Barcelona – the wealthy neighbourhood in which Messi has a home.

The pair this year paid back €5m (£4.2m) to the Spanish state, but this has not prevented the prosecution; with the country in financial crisis, the government has cracked down on tax evasion. The hearing on Friday will determine whether the court will pursue them for alleged tax evasion.

The allegations are a serious blow to Messi's golden image. He came to Barcelona as a young boy, and has grown up through the Catalan team's youth system, earning him the love of his fans.

He has a reputation as an honest player, rarely exhibiting the exaggerated diving and histrionics often associated with the Spanish game.

Messi, who earns around €16m a year just from his contract with Barcelona, is widely considered the best footballer in the world, on a par with his idol Diego Maradona.

It is an increasingly common practice for leading footballers to set up image rights companies in low-tax countries, through which they are paid their additional sponsorship salaries, thus avoiding the duty they might pay at home.

Messi and his father deny these charges, saying in a statement: "We have always fulfilled our tax obligations following the advice of our tax consultants who will take care of clarifying this situation."