He can't seem to link letters to the sound of the word in spelling, he wrote 'f' for 'th' when attempting to write 'the'.
Can he say /th/ correctly?
It's a bit unusual for children to substitute 'f' for 'th' when spelling 'the', they usually do it for words like 'thing', 'think' and 'thought' because that's how some say them; 'fing', 'fink', 'fought', but he may just be a bit muddled.
The thing to do is to practice relating the /th/ sound to its spelling. I would model it first, using a word like 'this' or 'that' as they have more straightforward letter/sound correspondences. So, using 'this', write each grapheme (sound spelling) on a separate piece of paper*, put them together and, if he can read the word get him to read it, if not, tell him 'this word is 'this' and get him to tell you each sound that he can hear, repeating it very slowly if necessary. Once each sound has been identified show him its grapheme 'this is /th/, this is /i/, this is /s/.' Then move on to writing 'th' "Can you write a /th/ for me?" He can copy it to start with but what you are working towards is him being able to write it without copying. Get him to say the 'sound' every time he writes it; this helps to promote muscle memory of how the sound is spelled. A few minutes practice at writing 'th' every so often will help with embedding an automatic response of writing 'th' whenever he hears the sound/th/.
It might seem odd that we're using another word initially but the objective is not to 'learn the spelling' of any discrete word but to learn an automatic written response to a discrete sound. Once learned this will transfer to any word in which there is a /th/ sound.
I know that our mate marsha will burble on about all the different spellings of discrete sounds but learning word specific spellings comes later. The first task is to embed the principle that each sound in a word has a 'spelling' and to make the breaking down of words into their component sounds in order to spell each sound an automatic reaction.
*If you have each grapheme on a separate piece of paper you can manipulate the word e.g pulling it apart to emphasise breaking it into sounds, pushing them together to emphasise how the 'sounds' are blended. You could do this with magnetic letters but they don't, as far as I know, come with digraphs (2 letters spelling one sound) already joined so aren't so explicit IMO. Post-it notes and a pen are cheaper and far more versatile 