The purpose of fasting is to please Allah, not to remain hungry. The
pre-requisite for the acceptance of a fast is to bring true and correct
faith in Allah.
However, if fasting may be a stepping stone for you to accept
Islam, then it is commendable.
Mufti E Desai