TL;DR: It's inconclusive. i.e cannot be sufficiently answered.
There is a massive amount of information on Wikipedia articles. Here I will only do a limited analysis of a few statements on Wikipedia.
Issue of the pre-existing temple
Article Ayodhya dispute The Ayodhya Mahatmya, described as a "pilgrimage manual" of Ayodhya,[12] composed and collected from the 11th century onwards,[13] traced the growth of the Rama cult in the second millennium AD. The original recension of the text, dated to the period between 11th and 14th centuries,[14] mentions the janmasthana (birthplace) as a pilgrimage site.[15] A later recension adds many more places in Ayodhya and the entire fortified town, labelled Ramadurga ("Rama's fort"), as pilgrimage sites.
R. Sharma (2001:129-130) points out that the Ayodhya Mahatmya gives specific directions to the janmasthana which places it far away from Babri Mosque, "somewhere between Rinmochan and Brahamakunda." He also argues that Ram's birthplace was never mentioned in medieval texts so even this is likely a later interpolation. The source being quoted in Wikipedia's footnotes 13-16, Hans Bakker, himself observes that medieval texts attempting to boost the cult of Ram never claimed that Ram was born in Ayodhya.
R. Sharma also discusses a poet writing in Ayodhya, who was speaking specifically about pilgrimage on Ram's birthday, but failed to mention any temple in Ayodhya. "Tulsidas, who wrote the Ramacharitamanas in 1574 at [Ayodhya], does not mention it as a place of pilgrimage. ... He clearly specifies the time and place when he wrote his famous Ramacharitamanas ... add[ing] that whoever sings the story of the birth of Rama on [the day of Ram's birth when he completed the poem] obtains the merit accruing from his visit to all places of pilgrimage automatically, but he does not declare [Ayodhya] a place of pilgrimage." Tulsidas refers to many nearby temples in this text, but never a Ram temple. (Sharma 2001:127-8)
Article Archaeology of Ayodhya
This article discusses a temple dedicated to Vishnu built between the 11th and 12th centuries in Ayodhya, possibly on the site later used for the Babri Mosque. It also discusses animal bones and Muslim graves which the archaeologists spirited away from the site but avoided analyzing in detail. It does not mention glazed Islamic-style pottery which was found lying on top of the Vishnu temple, which alongside the animal bones and Muslim graves, suggests that the temple was being used as a residential area by Muslims before the construction of the mosque in the 16th century. (Sharma 2001:132-134)
Issue of Muslim sources on building/destroying
It is part of the Hindu contention that "Muslim texts" describe the destruction of a Hindu temple in Ayodhya. No such primary source has been located. On one hand, this is not surprising because the Indian government allows old documents to rot. But the secondhand quotations that do exist are dubious even beyond Wikipedia's hesitant citation of them.
Article Babri Masjid: "The Baburnama (Chronicles of Babur) does not mention either the mosque or the destruction of a temple."
In fact, the Baburnama is missing leaves for the time when the temple is said to be constructed, between 12 Jumada 934 AH and 3 Muharram 935 AH. (Conermann 1994:281n45)
Article Babri Masjid: "the Muslim activist Mirza Jan quoted from a book" written by Aurangzeb's granddaughter in the early 18th century which describes the destruction of temples in past generations.
This book cannot have been written by Aurangzeb's granddaughter because she died in 1705 and the book's title refers to events that occurred in 1707. The original text has never been located and Mirza Jan was a fanatic who wanted to demolish more temples, which places the reliability of his account in question. Furthermore, even if real, this book does not describe the destruction of a Ram temple. (Conermann 1994:275)
Article Ayodhya dispute: "According to an early 20th century text by Maulvi Abdul Ghaffar and the surrounding historical sources examined by historian Harsh Narain,[note 3] the young Babur came from Kabul to Awadh (Ayodhya) in disguise, dressed as a Qalandar (Sufi ascetic), probably as part of a fact-finding mission. ... The older editions of Abdul Ghaffar's book contain more detail, which seems to have been excised in the 1981 edition. Lala Sita Ram of Ayodhya, who had access to the older edition in 1932, wrote, "The faqirs answered that they would bless him if he promised to build a mosque after demolishing the Janmasthan temple. Babur accepted the faqirs' offer and returned to his homeland."[34][35]"
This is a startling paragraph. Was the 1981 text a redaction, or was the manuscript cited in 1932 a revision based on an ideology like Mirza Jan's? Looking at the citations given on Wikipedia, there is no Redaktionsgeschichte going on here at all. Citation 34 goes to Dharam Veer Sharma's opinion in the 2010 court case, which is mind-boggling. Not only does this High Court justice not consider the possibility of a revision to the text, he accepts this outlandish story of a king disguising himself as a Sufi ascetic on its face. Even though the earliest citation of this dates to the "early 20th century," an incredible 300-400 years after the construction of the mosque.
I do not claim to derive a conclusion from this when Indian courts have been unable to do so, but I do think this helps show that the situation is more complex even than the confusing evidence laid out on Wikipedia. I hope that any more detailed answer to this question pursues the source The Babri Masjid Question 1528–2003: 'A Matter of National Honour' (New Delhi: Tulika Books, 2003) which is not available online. Ordinarily, I would be able to obtain this book but the relevant library is closed due to COVID.
References
Conermann, Stephan. "Muslimische Quellen in der Ram Janmabhumi Mandir-Babri Masjid Debatte." Internationales Asienforum 25, nos. 3-4 (1994).
Sharma, R.S. “The Ayodhya Issue,” in Destruction and Conservation of Cultural Property, ed. Robert Layton, Peter G. Stone, and Julian Thomas (New York: Routledge, 2001).