Pure science and pure ideology are two very separate, yet overlapping, entities. Neither one exists in the world - scientific research is always tinged by the personal biases or preferences of the investigator, and ideological battles are always infused with some amount of practicality. However, science can be separated from ideology through the simple fact that scientific discoveries are never accepted without evidence.
The requirements of the scientific method outline a very rigorous means of evaluating scientific questions; without hard experimental evidence, conclusions will not be accepted. As a result, any ideologically-influenced idea will be hard-pressed to gain respect without corresponding proof. Although researchers can purposely or unconsciously evaluate any results incorrectly, scientific research is also subject to peer review. Other scientists must analyze and generally approve of an experiment's method and findings before it can be published. This system usually results in the negation of any biases since it is much more difficult for any group of people to have the same ideological preference.
The idea behind peer review in science is present in other fields as well. For example, the adversarial system of justice in most countries relies on the fact that two opposing sides of any given case will contest each other in an open forum. From this, the truth can be discerned through the clash of statements and ideas. Similar balances occur in democratic government with different political interests ensuring that no single one gains too much power. Although all scientific observations are naturally affected by a person's ideas, any theory must be subject to the varying ideas of many other scientists before it can be widely accepted.
In addition, science usually moves slowly; any theory is usually not accepted whole-heartedly until it has been etsablished many times by many different investigators. This also is a bulwark against ideology creeping into scientific endeavors. If a specific experimental result cannot be reliably proven by different research teams, the findings are discarded or given less credence. Only theories that are well-proven and widely accepted are established as fact or near-fact.
Finally, experiments can be naturally designed to ensure as much blindness as possible on the part of the researcher. For example, s/he may opt to have others in the research team collect certain results, and to have still different people analyze those results. This prevents him or her from having too much input into the collection or interpretation of data. Again, ideological influences are minimized.
All of these built-in barriers ensure that science remains largely free from ideological impulses. Indeed, those who try to inject their personal biases into their scientific endeavors usually pay a high price. The careers of scientists who attempt to fake or purposely twist their results are inevitably cut short. With such a high price to pay, this is yet another internal brake against those who cannot or will not separate ideology from science.