EXCLUSIVE

Tamra Barney and Vicki Gunvalson were hospitalized -- one of them was even airlifted -- after a joyride in the California desert nearly turned tragic.

Law enforcement sources tell TMZ the accident happened in Glamis, CA around 12:50 PM Saturday ... when the Polaris RZR the women were riding in rolled over multiple times. A camera crew for "Real Housewives of the O.C." was taping at the time, and according to sources connected with production ... Tamra was behind the wheel.

We're told Vicki was airlifted to a nearby hospital for treatment. She was released early this morning with no major injuries. Tamra was also hospitalized, but released on Saturday.