Mishnah Avos 5:24 (or 25):
Ben Bag-Bag says: Turn it and turn it, for everything is in it.This is clearly about Torah and the implications seem to be two-fold. First, one need study only Torah to learn about the world. And second, the Torah cannot be incorrect about anything including scientific matters.
However, in truth, these inference do not necessarily follow from the above Mishnah. There are, of course, different ways to interpret the Mishnah. Below is first a summary of the various interpretations of this Mishnah found in the classic sixteenth century anthology of commentaries to Avos, Midrash Shmuel. Following that, I'll briefly explain what I believe to be the Rambam's approach to this matter.
1. Everything in the world has a part of God in it but the Torah has all of God in it. Therefore, it is endless. (In other words, this Mishnah is not referring to science at all but to metaphysical properties.)
2. All rewards--in this world and the next--can be obtained through the Torah. (Again, nothing about science.)
3. All views on every Torah matter are contained within the Torah, so keep studying until you find more opinions.
4. (On the repetition of "turn it":) One cannot understand Torah until one first raises problems with it and then resolves them. (A midrashic explanation of the word hapokh, reading it as "reverse" rather than "turn".)
5. All answers about the Torah are in it so if someone asks you a question about a Torah matter that you cannot answer, keep looking in many different books until you find a good answer. (Again, nothing about science.)
The Rambam was firmly of the view that Torah -- actual Torah, that is, and not necessarily every view of every sage -- is absolutely true and corresponds entirely with true philosophy/science. If, therefore, philosophy/science teaches a truth, it must correspond to Torah when understood properly. The key, in such a situation, is to understand the Torah properly. The following is from Charles H. Manekin, On Maimonides, pp. 14-15:
Maimonides would agree that the verse does not mean anything philosophical on a plain reading, but on a deeper level, it does. That is because he believes the Torah to be the repository of all wisdom; indeed, that encoded within it are the secrets of existence and of all sciences. These secrets were known to Moses who passed on the explanation orally to his successor, and thus for generations, until they were lost and forgotten among the Jews because of their wanderings and vicissitudes, and their secret nature...
The task of the exegete schooled in the true science of the Law is to reconstruct scripture's philosophical/scientific meaning. Since Maimonides believes that philosophy provides access to many of the truths of existence, the philosopher can discover those truths independently of scripture, and then reveal them within scripture...
Although Maimonides does not hesitate to interpret scripture and midrash philosophically, it is wrong to see the hermeneutical process as a one-way enterprise in which Maimonides reads into the text whatever philosophy teaches. Scripture guides the philosopher to find the truth where philosophy and science may be unable to do so.