Praise be to Allah.
It is permissible for the fasting person to take a bath , and that does not affect his fast.
Ibn Qudamah said in al-Mughni, 3/18:
“There is nothing wrong with a fasting person taking a bath . He quoted as evidence the report narrated by al-Bukhari (1926) and Muslim (1109) from ‘Aishah and Umm Salamah, that Fajr would come and the Messenger of Allah (peace and blessings of Allah be upon him) would be junub (in a state of major ritual impurity) following intimate relations with his wife, and he would do ghusl and fast.”
Abu Dawud (2365) narrated that one of the Companions of the Prophet (peace and blessings of Allah be upon him) said: I saw the Messenger of Allah (peace and blessings of Allah be upon him) pouring water over his head when he was fasting, because of thirst or heat. (Classed as sahih by al-Albani in Sahih Abi Dawud)
It says in ‘Awn al-Ma'bud:
“This indicates that it is permissible for the fasting person to seek relief from the heat by pouring water over part or all of his body. This is the view of the majority, and they did not make any distinction between ghusl that is obligatory and that which is recommended or permissible.”
Al-Bukhari (may Allah have mercy on him) said:
“Chapter on fasting person bathing: Ibn ‘Umar wetted a garment and threw it over himself when he was fasting, and al-Sha’bi entered the hamam (baths) when he was fasting… and al-Hasan said: There is nothing wrong with the fasting person rinsing out his mouth and cooling himself off.”
The fact that he called his chapter “Chapter on fasting person bathing” shows that it is permissible. Al-Zayn ibn al-Munir said: He called it bathing (ightisal) so as to include that which is Sunnah and obligatory and permissible, as if referring to the weakness of the report narrated from ‘Ali, which says that the fasting person is not allowed to enter the hamam (baths). This report was narrated by ‘Abd al-Razzaq but there is some weakness in its isnad.
And Allah knows best.