If he almost cheated and did not then you are going to have to find it in your heart to forgive him, he was honest about it and you are going to have to work on trusting him again. If you decide to stay with him then you are going to have to be able to forgive the past and look towards the future. Support him in his endeavor to find his religion again, this could actually be a blessing in disguise he can come closer to his faith and make your relationship stronger. If you have questions about what actually happened then ask them, get the answers you need to move on from this.
i just feel terrible about it all, and he told me only a couple of weeks before he comes back home. why would he tell me about this thing that happened in October, just this week? I told him i would forget about it and put it in our past but I still come up with questions every now and then and I cannot come out and say it because we made an agreement to put it in our past. what should I do?
You are going to have to be honest with him that this still hurts you and to be able to move on he has to answer your questions or else it will continue to eat you up and bother you to the point it's going to affect your relationship with him. He probably wanted to come home with a clear conscience so that you did not sense that something was wrong. True love is forgiving, it may not forget but it is willing to give the relationship another chance. Admission of wrong,being truly sorry for what happened and resolving not to let it happen again are crucial to saving the relationship. There must not be any room for thinking that the mistake can be repeated. You have to work towards ensuring that you do not keep bringing up the cheating any time you get into an argument, that will not be a good thing for your relationship so you have to do whatever it's going to take to get past this and also he has to be willing to help you find out why this almost happened.