Praise be to Allah.
It is permissible for the fasting person to take a bath, and that does not affect his fast.
Ibn Qudaamah 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-Bukhaari (1926) and Muslim (1109) from ‘Aa’ishah and Umm Salamah, that Fajr would come and the Messenger of Allaah (peace and blessings of Allaah be upon him) would be junub (in a state of impurity) following intimate relations with his wife, and he would do ghusl and fast.
Abu Dawood (2365) narrated that one of the companions of the Prophet (peace and blessings of Allaah be upon him) said: I saw the Messenger of Allaah (peace and blessings of Allaah be upon him) pouring water over his head when he was fasting, because of thirst or heat. Classed as saheeh by al-Albaani in Saheeh Abi Dawood.
It says in ‘Awn al-Ma’bood:
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-Bukhaari (may Allaah 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-Muneer said: He called it bathing (ightisaal) 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-Razzaaq but there is some weakness in its isnaad.
And Allaah knows best.