In July, I dropped out of my first race (800m) in 6 seasons of track. Was with the group at half way, but at 500m I tried to push and both my legs gave out. I lost balance and nearly fell over. Later discovered I had bad heat exhaustion from spending all of the previous day outside in 34 degrees Celsius.
While it sucks, dropping out of a race is something everyone does eventually. Our bodies have bad days even on race days. My case it was smarter to stop before I hurt myself. Take a few days off no running. Relax, eat, ice bath if it helps. Let your body recharge and try again later. All you can do