While the previous answer is not inaccurate, it does not address some factors that are very important specifically with regard to sociology (as opposed to other social sciences) and religion.
Sociologists would make a number of important arguments.
First, they would say that they are not studying beliefs themselves, but are studying the ways in which beliefs impact society. When they do this, they are not passing judgment on whether a belief is right or is wrong. Instead, they are looking at what impact that belief system has on the people who hold it. Therefore, they can study things like the impact of religious belief on terrorism or on violence in a place like Northern Ireland.
Second, they would say that they are studying how society affects belief, not the legitimacy of the belief itself. For example, a sociologist might study the topic of which groups are more likely to hold religious beliefs or to hold those beliefs particularly strongly. This is a sociological question. Why would immigrants, for example, be more fervent in their belief? Why would women be more likely to believe than men?
In these ways, sociologists would say that they are not studying religion as a system of belief. Instead, they are studying the intersection between religion and society. They are not trying to determine whether Religion X is better than Religion Y or whether any religion is true. Instead, they are trying to determine how religious belief affects society and vice versa. Please read this link for more information.
There is only so much social scientists, including sociologists, can do to respond to objections regarding the application of science to religion. The two are fundamentally antithetical. Religion, by its very nature, is dependent upon the psychological phenomenon of "faith." Faith, by definition, means the belief in something that cannot be scientifically measured. "Faith," as defined in the Bible, is as follows:
"Now faith is the substance of things hoped for, the evidence of things not seen." [Hebrews 11:1]
For as long as can be known, there has been tension between scientific and faith-based approaches to life, including within the scientific community. For sociologists, in particular, whose avocation is the study of human interaction and the way societies develop and evolve, attempts at reconciling the notion of a Supreme Being guiding mankind and dispensing justice is a life-long intellectual journey, except in the case of atheists for whom the notion of such a Supreme Being is without foundation. Either man's actions are determined by God, or those actions are determined by physiological and social factors having no bearing on whether God exists.
For some who hold firm to the belief that mankind was created by and remains influenced by a Supreme Being, scientific studies that purport to negate or marginalize the role of God in human development are without a moral compass and are deemed lacking in integrity. For many sociologists, these arguments are lacking in intellectual merit, and have no place in intelligent discussions of human evolution and interaction.