I wasn't sure where to post this, so I hope it fits here. I haven't investigated the source of this but someone I know has (his research is appended after the story). I also don't know if this has appeared in any other threads.
I think that the attitude in this is fascinating, and not in a bad way, but I wonder if it strikes anyone as problematic.
---------------
There is a famous story told in Chassidic literature that addresses this very question. The Master teaches the student that God created everything in the world to be appreciated, since everything is here to teach us a lesson.
One clever student asks “What lesson can we learn from atheists? Why did God create them?”
The Master responds “God created atheists to teach us the most important lesson of them all – the lesson of true compassion. You see, when an atheist performs and act of charity, visits someone who is sick, helps someone in need, and cares for the world, he is not doing so because of some religious teaching. He does not believe that god commanded him to perform this act. In fact, he does not believe in God at all, so his acts are based on an inner sense of morality. And look at the kindness he can bestow upon others simply because he feels it to be right.”
“This means,” the Master continued “that when someone reaches out to you for help, you should never say ‘I pray that God will help you.’ Instead for the moment, you should become an atheist, imagine that there is no God who can help, and say 'I will help you.’”
-----------------
Source: Chassidic stories are typically transmitted orally, and at times you'll find the same story attributed to different sources. The classic collection Tales of the Hasidim Volume 2 by Martin Buber (Schocken Press, 1958) has a condensed version of this story (titled "When is it good to deny the existence of God") attributed to Rabbi Moshe Leib of Sasov, the late 18th century student of Rabbi Shmelke of Nikolsburg and teacher of Rabbi Mendel of Kosov. The version above is based on my memory hearing this story many times in my youth.