If a person is not sure whether wind came out of him, his wudoo’ is not invalidated by this mere uncertainty; rather he has to carry on with his prayer, and in this case his prayer is valid and he does not have to repeat it, unless he is certain that he did pass wind.
Al-Bukhaari (137) and Muslim (361) narrated from Sa‘eed ibn al-Musayyab, and from ‘Abbaad ibn Tameem, from his paternal uncle, that he complained to the Messenger of Allah (blessings and peace of Allah be upon him) about when a man thinks that something has happened during the prayer. He said: “Do not stop unless you hear a sound or notice a smell.”
It was narrated that Abu Hurayrah said: The Messenger of Allah (blessings and peace of Allah be upon him) said: “If one of you feels something in his stomach and is not sure whether something came out of him or not, let him not leave the mosque unless he hears a sound or notices a smell.”
Narrated by Muslim (362).
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) said:
This – I mean basing things on certainty and ignoring uncertainty – is an important principle which is supported by the words of the Prophet (blessings and peace of Allah be upon him): “If one of you is uncertain about his prayer, let him ignore what is uncertain and continue on the basis of what is certain.”
In principle, The Prophet (blessings and peace of Allah be upon him) forbade praying when resisting the urge to relieve oneself and when one is distracted by trying to keep it from coming out.
It was narrated that # ‘Aa’ishah (may Allah be pleased with her) said: I heard the Messenger of Allah (blessings and peace of Allah be upon him) say: “There is no prayer when food is ready, or when one is resisting the urge to relieve oneself (by urinating or defecating).”
And if a person starts to pray when he does not feel that he is resisting the urge to defecate or urinate, and he only starts to feel that in the middle of the prayer, then in that case it is not makrooh if it does not prevent him from completing his prayer.
And Allah knows best.