It seems lile your linear layers are “too strong” for this task so you basically learn whole data instead of learning to generalize.
You can try to reduce amount of hidden layers
Edit: and add dropout inbetween those dense layers as it should help too
Edit 2 (kinda offtopic):  i also noticed that you don’t have any activation function on your last layer. Was it meant to be like that?