Coach Frank Klopas and the bench of the Chicago Fire celebrate after a late goal against D.C. United at RFK Stadium. (Ned Dishman/GETTY IMAGES)

D.C. United was moments from boosting its MLS playoff chances Saturday night when disaster struck.

Ahead on Dwayne De Rosario’s penalty kick in the 90th minute, United conceded two goals in added time — an unparalleled collapse for a club that has endured surreal setbacks this season — and lost to the undermanned Chicago Fire, 2-1, in front of 16,548 at RFK Stadium.

Despite a fourth consecutive defeat, United (9-12-11, 38 points) remained in the postseason chase — but just barely. D.C. will have to beat the Portland Timbers on Wednesday and Sporting Kansas City next Saturday, while also hoping the New York Red Bulls (43 points) lose at home to Philadelphia on Thursday.

No matter what unfolds, United isn’t performing as if it deserves a playoff berth. In a game of critical importance, D.C. barely put a scare into the Fire (8-9-16) until the late stages and fell apart under pressure.

“I’m gutted. This is one of the toughest losses I’ve ever taken” as a player or a coach, United Coach Ben Olsen said.

After De Rosario’s 15th goal — United’s only shot on goal in the game — Sebastian Grazzini scored a superb equalizer. Diego Chaves, who entered moments earlier, then tucked in Gonzalo Segares’s cross to complete an incomprehensible comeback. United goalkeeper Bill Hamid howled for an offside call on the buildup to the go-ahead goal, but play continued.

“This has been our season in a nutshell, right?” De Rosario said. “Giving up bad goals at bad times.”

The defeat left United crestfallen and frustrated. Charlie Davies (11 goals this season) didn’t enter until the 79th minute, his second consecutive brief appearance.

“I can only do so much with the time I have,” he said. “I’m a guy that expects to play 90 minutes. I’m fit. I’m healthy. It’s disappointing when you want to get the playing time to help the team win, and you only get 20, 15 minutes. I’ve done all I can do. I come in and bring energy to the game, change the game. I thought I did a good job. But I’m not getting a lot of time to go out there and really help the team.”

De Rosario, meantime, was bothered by the team’s inability to disrupt Grazzini’s shot.

“I just would like to have seen someone take [Grazzini’s shot] in the face or the body instead of jumping and turning their back on top of the box, especially 90 minutes, we’re up, the momentum, the fans on our side,” he said. “It’s just too easy.”

Chicago, which entered the night barely alive for a playoff berth, was without three suspended starters and lost defender Michael Videira to an early groin injury.

Despite the urgency of the occasion, United didn’t exactly seize hold of the match.

While D.C. labored to sustain possession, the Fire’s formidable attack raided the penalty area and forced Hamid to make two quality saves in the first half.

De Rosario is United’s most important player and needs to touch the ball as much as possible, but because he was positioned on the front line instead of in central midfield, he lacked influence most of the opening half.

Asked about the tactical decision, Olsen said: “Putting him up top was the right move. [Chicago] put a lot of numbers in the midfield and it’s a lot of work in there. . . . Everything worked out except the last couple minutes.”

In the 76th minute, United pleaded for a penalty kick. Andy Najar lifted a ball that appeared to strike Patrick Nyarko’s arm. Referee Jorge Gonzalez allowed play to continue.

United received the call it sought later, after Santino Quaranta was upended in the box.

De Rosario, who failed to convert a penalty in the waning moments of a tie game with Chivas USA three weeks ago, fired into the left side.

The celebration was still unfolding when Grazzini swerved a 20-yard one-timer into the left side. Two minutes later, Segares broke free on the left flank to set up Chaves.

“I don’t know how to explain it,” captain Josh Wolff said. “We have these little blips that are absolutely deadly to us.”

United notes: Defender Dejan Jakovic, who was hoping to return to the gameday roster Saturday after missing nearly two months with a hamstring injury, remained sidelined. . . .

At halftime, former midfielder Richie Williams (1996-2000 and 2002) became the sixth player inducted into United’s Hall of Tradition.