If there’s a worse job in the world than working the Explosive Ordnance Disposal beat in Baghdad, we haven’t seen it. It’s even worse than being Joe Biden’s barber — much worse. On a good day, the unit gets to spend the day disarming improvised explosive devices, only to go home to sweltering barracks to shake sand out of every crack. On a bad day, they’re dead.

“The Hurt Locker,” opening Friday, is based on the exploits of the elite Army group and chronicles a few weeks in the tour of three Bravo Company soldiers (Jeremy Renner, Anthony Mackie and Brian Geraghty). The film, directed by Kathryn Bigelow, is fiction but has a disconcerting realism due in part to the script by Mark Boal, a writer for Rolling Stone and Playboy, who spent a few weeks embedded with a Baghdad EOD unit in 2004.

“I knew it was going to be dangerous and intense — it’s obvious that it’s going to be,” Boal says, “but when I got there, I was quite surprised by how risky it actually is.”

“There were just so many bombs. A tidal wave,” he says. “I used to get these [situation reports], and they’d show you on a map of Baghdad with little pinpricks where the bombs had gone off that day. Literally every day you’d get an e-mail and the map would be covered with red dots.”

Boal says a single EOD squad of three men would, at times, be called on to dispose of more than 10 bombs per day. It’s no surprise that in 2004, when the film is set, mortality rates among EOD members were five times higher than regular soldiers’.

“Every day there was a close call,” Boal recalls. On one particular day, Boal watched as the squad blew up a gigantic car bomb abandoned on the highway. Boal decided to capture the controlled detonation on film.

“It was going to be a very large explosion, so they set the car in the middle of the highway, and then we pulled back about a mile,” he says. “I figured since I was a mile away, I’d stand up and just shoot it on video. The [EOD] guy I was with said, ‘You know what? You should be behind the truck.’ I thought he was just saying that.

“After the bomb went off, the explosion was so strong that oil from the car hit as far as where we were. And there was a big chunk of shrapnel that came whizzing by and hit the back of the truck. It tore a nice hole through the metal. I was probably about two feet from it, and I thought, next time, I’ll listen to them,” Boal says.

Each day was like low-grade terror, when most everything in the entire city could be lethal. “I remember one of the first days, someone was explaining to me the different places where you can hide an IED [Improvised Explosive Device],” he says. “It’s anything you can put your feet on. It can be under blacktop, it can be on a gravel road, it can be on a highway, it can be in a garbage can, hidden in a pile of rubble, secreted inside a telephone pole.”

Besides the feeling of constant, claustrophobic dread, one thing that separates “The Hurt Locker” from previous movies about the Iraq War is that it’s intentionally apolitical.

“People say, ‘There’s no politics in the trenches,’ and that’s true,” Boal says. “This is a movie about a bomb squad. It would be fake for me to insert a political speech into the middle of that environment. The moment you do that, you pierce the reality. No one is going to reach for their gun and say, ‘Hey, what do you think about Proposition 8?’ “