The quote applies to the idea of atheism versus religion.
Gibbon was against the idea of a government choosing between between secularism—no religion, with a government run on rational ideas—and theocracy—a form of government in which priests of a particular religion rule—as he thought neither idea was beneficial to the state.
The quote you cite comes from Gibbon's discussion of paganism: he applauded the Roman empire's tolerance of a wide variety of religious faiths before the advent of Christianity, asserting that such a system of religious beliefs benefitted everyone involved, as nobody was forced to be religious but anybody—particularly lower-class people—could worship as they wished. Gibbon's context is anti-theocratic. He liked the idea of the civic virtues of patriotism, courage, and sacrifice for the state as the glue holding society together.
The statement is cynical, meaning it dismisses the idea that religion could be real or have any more substance than its value in manipulating the foolish, but it also acknowledges that it can be useful.
It is worth noting that Gibbon in The Decline and Fall of the Roman Empire blames the adoption of Christianity as the state religion (ie, establishing a theocracy) from the Emperor Constantine onward as contributing to the empire's fall by weakening its civic virtues and contributing to it becoming "indolent" and "effeminate." He wrote:
As the happiness of a future life is the great object of religion, we may hear without surprise or scandal that the introduction, or at least the abuse of Christianity, had some influence on the decline and fall of the Roman empire. The clergy successfully preached the doctrines of patience and pusillanimity; the active virtues of society were discouraged; and the last remains of military spirit were buried in the cloister ...