The Book of Genesis does not mention Moses but in the middle 3 books Moses as the main protagonist and prophet is referred to in third person. In Deuteronomy however Moses speaks in first person mainly. Why the switch?

I agree with yoou that there are large sections of Deuteronomy in 3rd person. However the vast majority is still first person which is not the case by the other books. But you make a good point that there is no narrative in the middle which might be the beginnings of answer
–
Michael HorwitzJul 31 '13 at 3:16

1

My point wasn't to find exceptions to the first person, but rather that Deuteronomy is 3rd person narrative, but about 80%--90% or so of that narrative records Moses speaking to Israel. By contrast, Nehemiah would be a book that is actually written in first person. Parts of Daniel are also first person narrative. There is a difference between recorded dialogue (even if it's one-sided) and first person narrative.
–
TJamesBooneJul 31 '13 at 14:33

Deutoronomy or Debarim (The Words) is, what Moses spoke to Israel towards the end of their travels through the wildernis and deserts of Arabia, and it were his final words to them before he died and before they entered the land.

So much of it is direct speech it would have been unnatural, had he spoken of himself in third person after all these (almost 40 years). Moses - I believe - was not in danger anymore that he would transgress by exalting himself the way it had happened when he and Aaron had exalted themselves before Israel at Meriba.