One of the most fruitless questions that can be asked of religions is whether or not they are "true". For the sake of argument and the flow of this article, let us simply assume from the start that they aren't true in the supernatural sense. For a certain kind of atheist, this is the end of the story; but for those of a more ethnographic bent, it is clearly only a beginning. If we made up our gods to serve psychological needs, a study of these deities will tell us a crucial amount about what we require to preserve our sanity and balance, and will raise intriguing questions about how we are fulfilling the needs to which religions once catered.

Although we tend to think of atheists as not only unbelieving but also hostile to religion, there is a minor tradition of atheistic thinkers who have attempted to reconcile suspicion of religion with a sympathy for its ritualistic aspects. The most important and inspirational of these investigations was by the visionary, eccentric and only intermittently sane French 19th-century sociologist Auguste Comte.

Comte's thinking on religion had as its starting point a characteristically blunt observation that, in the modern world, thanks to the discoveries of science, it would no longer be possible for anyone intelligent or robust to believe in God. Faith would henceforth be limited to the uneducated, the fanatical, women, children and those in the final months of incurable diseases. At the same time Comte recognised, as many of his more rational contemporaries did not, that a secular society devoted solely to financial accumulation and romantic love and devoid of any sources of consolation, transcendent awe or solidarity would be prey to untenable social and emotional ills.

Comte's solution was neither to cling blindly to sacred traditions, nor to cast them collectively and belligerently aside, but rather to pick out their more relevant and secular aspects and fuse them with certain insights drawn from philosophy, art and science. The result, the outcome of decades of thought and the summit of Comte's intellectual achievement, was a new religion: a religion for atheists, or, as he termed it, a religion of humanity.

Comte presented his new religion in two volumes, The Catechism of Positivism: Summary Exposition of the Universal Religion (1852) and the Theory of the Future of Man (1854). He observed that conventional faiths usually cemented their authority by providing people with daily (and even hourly) schedules of who or what to think about - rotas typically pegged to the commemoration of a holy individual or supernatural incident. So he announced a calendar of his own, animated by a pantheon of secular heroes and ideas. In the religion of humanity, every month would be devoted to the honouring of an important field of endeavour - for example, marriage, parenthood, art, science or agriculture - and every day to an individual who had made a valuable contribution within these categories.

Comte was impressed by the way in which established religions had disseminated moral guidance - dictating principles for how to conduct oneself in marriage, say, or fulfil one's duties to the community - and he lamented that modern liberal governments, in their desire to prove inoffensive to all constituencies, had settled on merely offering factual instruction before letting people out into the world to destroy themselves and others through their egotism and self-ignorance. Therefore, in Comte's religion of humanity, there were classes and sermons to help inspire one to be kind to spouses, patient with one's colleagues and compassionate towards the unfortunate.

Because Comte appreciated the role that architecture had once played in bolstering the claims of old religion, he proposed the construction of a network of secular churches or, as he called them, temples of humanity. He suggested that each could be paid for by a banker, whose bust would appear above the door in recognition of his generosity. Inside the temples, there would be lectures, singing, celebrations and public discussions. Around the walls, sumptuous works of art would commemorate the greatest moments and finest men and women of history. Finally, above the west-facing stage, there would be an aphorism, written in large golden letters, invoking the congregation to adopt the essence of Comte's philosophical-religious world-view: Connais-toi pour t'améliorer ("Know yourself to improve yourself").

Comte's complex, thought-provoking and often deranged project was regrettably felled by a host of practical obstacles. Ridiculed by atheists and believers alike, ignored by public opinion and devoid of funding, Comte fell into despair and self-pity. He took to writing long and frightening letters in defence of his scheme to monarchs and industrialists across Europe, including Louis-Napoléon Bonaparte, Queen Victoria, the crown prince of Denmark, 300 bankers and the head of the Paris sewerage system - but few offered replies, let alone money. Without seeing any of his proposals take hold, Comte died at the age of 59.

Nevertheless, Comte, like Jesus, was well served by his followers, and in the decades after his death, his religion made notable advances. The Chapelle de l'Humanité was opened at 5 rue Payenne in Paris, where it still stands today, and became a well-known venue for secular baptisms, funeral services, weddings and sermons. The religion crossed the Channel, where it acquired 5,000 adherents, led by the former Oxford don Richard Congreve. In 1878, Congreve opened the Church of Humanity in Lamb's Conduit Street, London, where secular services were held every Sunday morning. "We gratefully commemorate the beauty of mother earth," began one example, which Congreve delivered in a white tunic with a chain around his neck bearing Comte's image on one side and Plato's on the other. "We meet as believers in humanity. We use all that the past can offer us by way of wise utterances - poems or music, the religious writings of the east or west - but we admit of no revelation and no being outside of man." Services ended with a prayer to Comte: "Great teacher and master, revealer of humanity, prophet of the future, founder of the one universal religion."

Whatever its shortcomings, Comte's religion is hard to dismiss entirely; it identified a psychic space in atheistic society that continues to lie fallow and to invite resolution. Comte's ability to sympathise with the ambitions of conventional religions, his study of their methods and his efforts to adapt them to the needs of secular minds, showed a creativity and a tolerance of which most later critics of religion have been incapable.

From a distance, Comte's approach might seem to invite the creation of secular religions, complete with updated versions of holy texts, uniforms and inspiring songs. But there is, perhaps, a more plausible and less kitsch moral to be drawn. Rather than founding new religions, Comte prompts us to consider the effects of the disappearance of beliefs, a process comparable to a tongue rolling over the gummy pocket of an absent molar. His utopianism could inspire us to revisit a range of religious concepts that could enrich or invigorate secular life, in areas such as education, community politics, travel or marriage.

Religions continue to detain our attention for their sheer ambition: they constitute an unrivalled collective attempt to understand our condition, to provide moral education, to glorify insights in art and to embed wisdom in global, trans-generational institutions - efforts that put into perspective the achievements of even the greatest and most influential secular movements and individuals.

Comte's thinking was an attempt to be unjust to the dogmatic aspects of religion in order to extract ideas that could sound plausible and even consoling to sceptical, secular minds facing the irritations of communal life or the terrors of finite existence. It attempted to rescue some of what is beautiful, touching, reasonable and wise from what no longer seems true. For these reasons, it is extremely timely.

Alain de Botton's "The Pleasures and Sorrows of Work" is published by Penguin (£10.99)