A United Airlines pilot started ranting about her divorce and the state of politics over her plane’s intercom just before takeoff — then told passengers they could get lost if they didn’t like it, according to video and passengers.

The apparently emotionally distressed pilot, who was dressed in a baseball cap and street clothes, went on her bizarre Saturday morning diatribe aboard her plane at Austin-Bergstrom International Airport in Texas, babbling over its PA system minutes before its scheduled takeoff for San Francisco.

“Don’t worry, I’m going to let my co-pilot fly – he’s a man,” the female pilot said at one point, according to the video.

“If you don’t feel safe, you can get off!” she sneered, prompting several passengers to jump out of their seats and head for the exit.

“Did I purposely offend you? The answer is yes!” she added.

The pilot was eventually removed from the flight, and another was brought on board, officials and witnesses said.

Passenger Randy Reiss was among those tweeting about the bizarre incident.

“She got on in street clothes and asked if we were ok with her flying like that. We all said okay. Cute, right?” he posted to Twitter.

But the female pilot’s charm quickly wore off when she tucked into a scary rant.

“So then she says “sorry, I’m going through s divorce.” Ummm uh oh,” Reiss wrote.

The pilot then allegedly said “I don’t care if you voted for Trump or Clinton. They’re both a–holes.”

About half of the passengers decided to disembark while she was on the plane, Reiss said.

While waiting to re-board, Reiss came across the pilot, who he tweeted was still in tears and apologized for the incident.

“Being a pilot is a tough and stressful job,” the passenger wrote. “This particular pilot did not seem emotionally equipped to do that job today. I hope she gets the help she probably needs.”

The flight eventually took off safely, two hours late.

“We hold our employees to the highest standards and replaced this pilot with a new one to operate the flight,” A United Airlines statement read in part. “We apologize to our customers for the inconvenience.”