I would like to know if it is Halal to write fictional books (within Islamic values) or would it be considered a form of lying.
Praise be to Allah, the Lord of the World; and may His blessings and peace be upon our Prophet Muhammad and upon all his Family and Companions.
In a sound Hadith the Prophet said: "Inform of Banu (children of) Israel's (news, tidings) and there is no blame (on you)". [Ahmed and Abu Dawood]
Ibn Abu Shaiba added, "There were wonders among them".
Thereupon, scholars of Islam believe that listening to such wonders and tidings, for the sake of amusements only, is Halal.
So, we state that listening to such wonders, homilies and tidings or relating them for the sake of implanting good morals and good qualities, whether they be done by animals or human beings, is Halal provided that listener or reader knows that this is no more than fiction. This is the view of Ibn Hajar al-Haitami.
Scholars of Hanafi school believe that such fiction is reprehensible. Ibn 'Abdin, a Hanafi scholar, did not approve the above-named opinion of Hanafi school if such fiction is accompanied with good goal.
Finally, we see that it is permissible to write books of fiction with Islamic values if a reader knows that or it is written for teaching. Al-Hariri's book includes such fiction and we do not know any scholar criticized it.
Allah knows best.
You can search for fatwa through many choices