The shooting took place around 6:40 p.m. at the fairgrounds, as the horse races were ending and people were starting to line up for a concert by the rapper.
Investigators say the man went to a ticket window at the Del Mar Fairgrounds looking for a ticket to the concert.
When he was told there were no more tickets available, an argument began and deputies came by to assist.
Officials say the man pulled out what was described as a silver-plated semi-automatic handgun and fired several shots in a crowded area.
Deputies returned fire. In video from witnesses, it appears the man was struck more than once by gunfire and he collapsed to the ground. Deputies were seen then trying to provide him with medical assistance.
The man was transported to Scripps Memorial Hospital in La Jolla.
Track officials say the concert is still going on as scheduled.
"The situation has been contained," the racetrack tweeted. "The concert is moving forward as planned."
The situation has been contained. The concert is moving forward as planned.— Del Mar Racetrack (@DelMarRacing) September 3, 2018
An update on the man's condition was not immediately available.
City News Service and ABC News contributed to this report.