It didn’t look like a house anyone would pay $400,000 extra for.

Several walls inside the gray townhouse with blue trim were streaked with water stains. The first floor was noticeably uneven. And termites had dined in front.

The big pluses: It was 2,850 square feet, had off-street parking, and was in walking distance of Union Station and the bars and restaurants along H Street NE. Then there was the list price: $337,000. Similar houses in the neighborhood were going for closer to $500,000.

Two weeks and 168 bids later, the house — in the 800 block of Fourth Street NE — was sold this month for $760,951 to an unidentified buyer.

The sale floored many real estate agents, including James Lisowski, whose clients put in a losing bid. “I don’t think it was worth that finished,” he said, alluding to the house’s distressed condition.

This home in the 800 block of Fourth Street NE was sold this month for $760,951 to an unidentified buyer. (Sarah L. Voisin/The Washington Post)

While much of the nation is still struggling to emerge from a historic housing-market meltdown, the District is reliving its boom days. High rents, low interest rates, low inventory, and a flood of new residents in their 20s and 30s are making parts of the city feel like it’s 2005 again.

The median home sale price in the District is up 14 percent from last year, according to RealEstate Business Intelligence (RBI). And the average number of days houses spend on the market has fallen by nearly 30 percent, to 53 days.

Bidding wars have become commonplace along H Street NE, in Trinidad and in Eckington, among other areas. So have multiple cash offers and sales that soar past the asking price. In certain neighborhoods, buyers once again are snapping up unbuilt units based on floor plans. And more are forgoing inspections or appraisals.

Seattle, Boston and Palo Alto, Calif., are experiencing the same kind of scramble as Washington, with offers being made before open houses are held. (One house hunter in the Boston area told the Boston Globe this year that the desperate buyers reminded him of “people trying to get on the last lifeboat on the Titanic.”)

Nationally, home prices have been edging up. According to the closely watched S&P/Case-Shiller index, average home prices for the third quarter increased 3.6 percent from the same period last year.

Homes in Arlington, Fairfax and Montgomery counties — all of whose median sale prices are up more than 4 percent from last year — are reaping battlefield premiums. One Maryland couple beat out the competition by agreeing to adopt the seller’s dog.

In the District, the House of 168 Bids is another case of deja vu.

Real estate hot spots in the District

The house at 825 Fourth St. NE was unusual in a few respects. It had been in foreclosure, which is rare in the city because of a de facto moratorium that began after the city revamped its foreclosure process in 2010.

Katherine Rollins, one of the former owners, said she and her then-husband held on to the house after buying another home in Bowie. But they could not afford to keep both, she said. The bank foreclosed in 2010, the same year the couple filed for divorce, public records show.

The Fourth Street house ended up with the U.S. Department of Housing and Urban Development, which disposes of foreclosed homes that were financed with Federal Housing Administration-insured mortgages. Would-be buyers had to agree to live in the house. No investors needed to apply. And they had two weeks to put in an offer through the HUD Web site, an unusually long time for such a hot property, said Leslie White, an agent with Redfin, an online real estate company.

Communication systems engineer Aamir Yousufzai, 26, had his eye on the place as soon as it hit the market Nov. 26. He had been looking for a house since September and is a veteran of several bidding wars.

The condition of the house did not faze him. He had seen worse. He decided to go for it.

“It just looked like it had a ton of potential,” he said.

Lisowski, an agent with Keller Williams Capital Properties, had four clients who felt the same way. He toured the house about a dozen times, including once with a contractor. Ten to 15 interested buyers and their brokers were in the house with him at any given time.

Given the amount of work the house needed, three of Lisowski’s clients chose not to bid. A fourth pair put in what Lisowski thought was a very aggressive offer that turned out to be $100,000 off the mark. (The name of the buyer won’t be known until the sale closes in mid-January.)

“The city is filled with people who are playing hardball after losing a few places” in bidding wars, said Lisowski’s business partner, Ty Voyles.

To be sure, the housing recovery has been uneven. In Northeast Washington, the boomlet has bypassed Benning Heights, Central Northeast and Deanwood. In the Zip code those neighborhoods share, 20019, the median sales price is down more than 7 percent from last year, and houses take more than three months, on average, to sell, RBI reported.

The foreclosure moratorium has helped prop up prices in the District by keeping foreclosures off the market, said George Rothman, president of the nonprofit housing developer Manna. It has also made it harder for organizations such as Manna to find properties to rehab and sell to lower-income buyers.

Bullish real estate agents say it is only a matter of time until those areas catch up as well. There is no talk of “bubbles” or fallout from a dive off the “fiscal cliff.” People are still moving to the Washington area, where the population grew by 122,000 from 2010 to 2011, Census Bureau data show.

The combination of high demand and low supply is pushing buyers priced out of the Atlas District, as H Street NE is also known, to the north and east. Investors and first-time buyers have descended on Orleans Place, a one-block street in Near Northeast that was once the home base of 1980s drug kingpin Rayful Edmonds III.

Not far from there, in Trinidad, a client of Voyles’s recently outbid seven others for a modest three-bedroom rowhouse. She prevailed by paying cash and going $8,000 above the $270,000 list price. Anacostia has become so popular with investors and first-time buyers, real estate agents say, that more people are starting to look in nearby Randle Highlands and Dupont Park.

The once-slumping condominium market is also coming back in areas such as Logan Circle in Northwest, where buyers have rushed the unfinished Northern Exchange building. Upscale apartment developer P.N. Hoffman is converting the 110-year-old former Chesapeake & Potomac Telephone Co. building into 36 “micro lofts.” (Micro loft seems to be short for small and expensive.)

Prices range from the high $300,000s to the $800,000s for apartments that range from about 500 to 1,000 square feet. In recent months, Hoffman has been offering about eight units at a time — and selling out in about 90 minutes. About 400 people came to the most recent open house, and there is a waiting list for the larger penthouses.

Chief executive Monty Hoffman said the response to Northern Exchange shouldn’t surprise anyone, given its proximity to trendy bars and boutiques and its industrial-chic aesthetic. It is what people move to a city for.

“People prefer their homes and lifestyle to not be mass-produced,” he said, adding that Northern Exchange “has grit. People love authenticity.”

A suitably gritty and authentic abode still eludes Yousufzai, the systems engineer. He put in an offer on the Fourth Street NE house and came up $250,000 short.

In a way, he said, that lessened his disappointment.

“It is easier than if I had lost by $10,000,” he said.