How is The Candidate a representation of the real president of Chile, Salvador Allende?
This book was written by Isabel Allende, who was the niece of Salvadore Allende, so it is highly likely that she based her story on the life of her uncle.
In its review of the novel, Time magazine noted:
Allende, a former journalist, has even scored a success in her native Chile, despite the fact that the present government came to power after the 1973 assassination of her uncle, Marxist President Salvador Allende Gossens. Although the book is sympathetic to the dead leader, Chile's ruling junta has permitted the novel to pass through its stringent censorship.
Entrepreneur.com says of the book and its author:
The brutal events of 1973 [the death of her uncle and the overthrow of his government] forever changed Chilean author Isabel Allende's life. After the coup d'etat, Allende--then a 31-year-old journalist--fled to Caracas....In 1979, six years into Pinochet's reign, she learned that her 99-year-old grandfather had decided to die. Because she couldn't return to Chile, she began a spiritual letter to him. This letter, which eventually reached 500 pages, became the manuscript for The House of the Spirits (1982)--a family chronicle, a political testimony, a work of magical realism.
See also the eNotes article on the historical context of the novel, linked below.