"No politician can seek vote in the name of caste, creed or religion," said Chief Justice T.S. Thakur in an order, adding that election process must be a "secular exercise".
India is officially secular but political parties have traditionally used religion and caste as the main criteria to select candidates and to appeal to voters.
India's Hindu Sena celebrates Trump victory
Prime Minister Narendra Modi's ruling Bharatiya Janata Party (BJP) has for years fought elections on a Hindu nationalist agenda, with party members in the past being accused of making anti-Muslim statements to polarise Hindu voters.
The court ruling comes just weeks ahead of a state election in Uttar Pradesh, India's most populous state where the two issues of religion and caste generally dominate campaigns. Results of the election will be important for Modi's expected bid for a second term in 2019.
State elections are also due this year in the states of Punjab, Uttarakhand, Goa and Manipur.
India Supreme Court: Hindu temple ban on some women is unacceptable
The Supreme Court, ruling on a petition filed by a politician in 1996, wrote in its opinion that the secular ethos of the constitution had to be protected. The majority view of the seven-judge Supreme Court bench held that elections would be void if a politician made an appeal for votes on the basis of religious sentiment.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ