BUENOS AIRES, Aug 11 (Reuters) - Argentine traders are keeping a close eye on primary elections on Sunday, which will reveal the likely outcome of the Oct. 22 general ballot, with a major market crash after the same vote in 2019 still seared in their memories.

The primary, which unusually is an obligatory nationwide vote, defines internal leadership battles and acts as a dry run for the general election. It will show how likely the ruling Peronist coalition is to lose power to the main conservative opposition or even a far-right libertarian.

The primary vote four years ago delivered a shock landslide defeat to the government of conservative then-President Mauricio Macri, sparking a crash in bonds, equities and the peso currency that Argentina has yet to fully recover from.

"The election, even though it's a primary, could define the future vision of the market for the years ahead," Mauro Natalucci from local brokerage Rava Bursátil said on Friday.

The candidates from the main two political blocs are quite moderate. Ex-security tsar Patricia Bullrich and Buenos Aires city Mayor Horacio Larreta are vying to lead the opposition, and Economy Minister Sergio Massa is a unity candidate for the Peronists.

That should temper market reaction to the vote. But with pollsters less than confident about their predictions, outsider libertarian candidate Javier Milei could give markets a shock if he wins much more than the one-fifth of the votes that polls give him now.

Milei, who has risen on the back of voter anger at inflation near 116% and declining spending power that has left around four-in-10 people in poverty, has pledged to shutter the central bank and dollarize the country's economy.

Market focus is on what will happen with the Argentine peso, which is shackled by currency controls in official markets, but has hit over 600 per dollar in unofficial parallel trading. Expectations of a formal devaluation have shot up.

SBS Group said there had been "high appetite for currency hedging" in the week leading up to the vote, with many people looking to buy dollars despite the elevated cost.

Bonds, which remain in distressed territory after their crash four years ago, have been ticking up in recent months on hopes that political change could usher in more market friendly policies, despite the real risk of further debt defaults.

The country's S&P Merval stock market index, meanwhile, has been soaring, seen as a safe haven for local investors and a refuge from the damaging impact of inflation.

Whoever comes out on top will face a battle to bring down triple-digit inflation, rebuild reserves that are estimated to be in net negative territory and salvage a $44 billion loan program with the International Monetary Fund.

"The next administration will face enormous economic challenges. And Argentina's history shows that even the best-intentioned administration might struggle to put the economy on a more sustainable footing," Capital Economics said in a note.

(Reporting by Jorge Otaola and Walter Bianchi; Writing by Adam Jourdan; Editing by Cynthia Osterman)