I assume that the quote from Pesachim 50b that you are referring to is "metoch shlo lishma bah lishma", which means that if you do what G-d commanded for your own sake (because G-d will reward you), then you'll eventually come to do it for his sake. This is talking about someone who actually believes they are doing what G-d commanded. I have never heard it interpreted as someone who doesn't believe at all. The talmud says that "mitzvos tzrichus kevanah". In order to actually perform what G-d commanded, you have to realize and recognize that you are doing what G-d commanded. Without any belief in G-d, no matter what actions you do, Judaism teaches that you are not doing anything at all. Judaism is a religion of thought and action. If you have a complete lack of one of those two things, you are not observing the religion whatsoever.