The fasting is valid for the one who is Junub when dawn comes Sahih Muslim 1109 b
Translation
'A'isha, the wife of the Messenger of Allah (ﷺ), said
The dawn broke upon the Messenger of Allah (ﷺ) during the Ramadan in a state of junub not because of sexual dream (but on account of intercourse) and he washed himself and observed fast.