What is the ruling on using AI to write school assignments?
Question

Is it permissible for a university student to use the AI app ChatGPT to help in writing program code that has to do with university assignments, as a type of research and learning? Is it regarded as being like using the search engine Google when it is used for the purpose of research?
Praise be to Allah.Firstly:
There is nothing wrong with using AI for beneficial and useful purposes, because the basic principle is that useful things are permissible, as Allah, may He be Exalted, says (interpretation of the meaning):
{It is He who created for you all of that which is on the earth} [Al-Baqarah 2:29]
{Say, “Who has forbidden the adornment of Allah which He has produced for His servants and the good [lawful] things of provision?” Say, “They are for those who believe during the worldly life [but] exclusively for them on the Day of Resurrection”} [Al-A`raf 7:32].
Shaykh Ibn `Uthaymin (may Allah have mercy on him) said: One of the principles affirmed by the scholars is that useful things are permissible and are allowed, except those for which there is proof that they are prohibited. This principle is based on the texts of the Qur’an and Sunnah.
In the Quran, Allah, may He be Exalted, says (interpretation of the meaning):
{It is He who created for you all of that which is on the earth} [Al-Baqarah 2:29].
In the Sunnah, the Prophet (blessings and peace of Allah be upon him) said: “Allah, may He be exalted, has enjoined obligatory duties, so do not neglect them. He has set limits, so do not transgress them. He has said nothing about some things out of mercy towards you, not out of forgetfulness, so do not enquire about them.” And he said: “Whatever He said nothing about is overlooked.” (End quote from Majmu` Fatawa Ibn ‘Uthaymin, 12/169)
Secondly:
With regard to using AI to write program codes having to do with university assignments, what appears to be the case is that it is not permissible, because the aim of the assignments is to train the student, measure his ability and make sure that he has revised and studied the subject material, and relying on AI to do these assignments will undermine all these objectives. It is like taking the codes from a classmate, which means that the student will put very little effort into the assignment, so it is more akin to cheating than to researching on Google and the like. If someone looks on Google and takes an already-written assignment, that is cheating, because he has put little effort into it himself, and this is the same. If you are uncertain and have some doubts, you should ask the teacher whether it is allowed to do the assignment using AI or not.
For more information on the dangers that AI poses to university education, please see: Adh-Dhaka’ Al-Istina`i Fursah lit-Ta`lim Al-Jami`i Aw Khatar ‘Alayhi?
And Allah knows best.