If he forgets this and observes a Mustahab fast and...
If he forgets this and observes a Mustahab fast and remembers it before Zuhr his Mustahab fast will be void and he can convert his intention to the fast of qadha, and if he takes notice of the situation after Zuhr his fast is void as a precaution, and similarly if he remembers this after Maghrib, the validity of his fast is a matter if Ishkal.
Issue 1573: * If it is obligatory for a person to observe a specific fast other than the fast of the month of Ramadhan, for example , if he has vowed that he would observe fast on a particular day, and he does not make an intention purposely till the Adhan for Fajr prayers, his fast is void.
And if he does not know that it is obligatory for him to fast on that day or forgets about it and remembers it before midday, and if he has not performed any act which invalidates the fast and makes an intention to fast, his fast is in order, and if he remembers after Zuhr, he should follow the precaution applied to the fast of Ramadhan.
Issue 1574: If a person does not make an intention till near Zuhr for an obligatory fast which has no fixed time, like a fast of Kaffarah, there is no harm in it. In fact, if he had decided before making a niyyat that he would not fast, or was undecided as to whether he should or should not fast, if he has not performed any act which invalidates a fast, and decides before Zuhr to fast, his fast will be in order.
Issue 1575: * If a non-Muslim embraces Islam in the month of Ramadhan before Zuhr, he should, on the basis of obligatory precaution, make an intention to fast, and complete it provided that he had not committed any act which would make a fast void. And if he does not observe fast on that day he should give its qadha.
Issue 1576: * If a patient recovers from his illness in the middle of a day in the month of Ramadhan, before Zuhr, and if he has not done anything to invalidate the fast, he should make niyyat and fast. But if he recovers after Zuhr, it will not be obligatory on him to fast on that day. Issue 1577: * If one doubts whether it is the last day of Sha'ban or the first day of Ramadhan then the fast on that day is not obligatory.
If however, somebody wants to observe fast on that day he cannot do so with the intention of observing the Ramadhan fast, but if he makes an intention that if it is Ramadhan then it is the Ramadhan fast and if it is not Ramadhan then it is qadha fast or some other fast like that, his fast will be valid.