Maryland officials say they are close to finalizing a plan for paying to rebuild the state’s troubled online health insurance marketplace, a project that’s expected to cost $40 million to $50 million.

The state plans to use leftover federal grants from the construction of the first exchange plus funding from Medicaid, said Joshua M. Sharfstein, Maryland’s top health official and chairman of the exchange board. Maryland will not request any additional grant money, he said at a board meeting Friday evening.

Federal authorities are “comfortable” with this plan, Sharfstein said, but they have not given final approval. Until that happens, Sharfstein declined to detail how much money would come from each source.

Maryland was one of 14 states that opted to create their own Web sites for residents to shop for health insurance plans made possible by the Affordable Care Act rather than using the federal marketplace, Maryland’s exchange crashed on its first day and struggled through the first open enrollment period, which ran from Oct. 1 to March 31. The state enrolled many more people in Medicaid than expected, but the number that enrolled in private health plans greatly lagged expectations.

The struggling Web site has been a particular embarrassment for Lt. Gov. Anthony G. Brown (D), who was placed in charge of implementing health-care reform in Maryland by Gov. Martin O’Malley (D). Brown is running for governor and has touted Maryland’s implementation of health-care reform as one of his successes.

The first exchange cost at least $129 million to build and operate, with the federal government picking up nearly all of the bill. About $90 million of that went toward technology-related costs. That Web site was so unstable and glitch-ridden that officials decided it would be cheaper and faster to rebuild it than to continue fixing the site.

On April 1, Maryland hired Deloitte Consulting to rebuild the system using software from Connecticut. State officials say they expect to spend $40 million to $50 million on the rebuild, although consultants have said the cost could go as high as $60 million.

The total price tag is beginning to come into focus as Maryland finalizes contracts: Deloitte’s services will cost around $40 million, state officials say. Hosting will cost $29.3 million over five years and some software licenses will cost $14.2 million over three years. Maryland has also hired KPMG to manage the project, and it will soon hire a company to perform independent audits of construction of the system.

Federal authorities are closely monitoring Maryland’s progress to ensure that the newly built exchange is fully functional by Nov. 15, when the next open enrollment period begins. The state passed a first round of testing earlier this month and will return for another round before June 15.