Just for the record, this command removes write permissions from the file:

sudo chmod -w /boot/config.txt

Restore them only for the owner (the default) with u+w instead of -w.

But note that any script that runs with admin rights can change the file nonetheless.

edit: Ah, I noticed the logical flaw in this. The file is owned by the admin user root and it is already only editable by the owner. So removing w wouldn't make any difference in this case. 😇