The Heritage Lottery Fund has given £2.8m to establish the £10.7m facility.
It is hoped the Dunfermline Museum and Art Gallery will bring to visitors the story of the ancient town from the 11th to the 15th century.
The museum will link two Victorian buildings – the Dunfermline Carnegie Library, the first library funded by the philanthropist Andrew Carnegie, and an adjacent B-listed former bank.
It will include a museum, art gallery, archive, library and local history services. Currently inaccessible collections will be displayed and interpreted for the first time, and there will be facilities to stage touring exhibitions and education events.
Colin McLean, head of the Heritage Lottery Fund in Scotland, said: "The new museum will be a fantastic boost for Dunfermline and a top visitor attraction for Scotland.
"New life will be breathed into these two striking buildings so that treasures, which have been stored away for years, can be brought out for people to enjoy in a dynamic and contemporary setting."
Councillor Mike Rumney, chairman of Dunfermline area committee, said: "This really is fantastic news for Dunfermline and for Fife.
"This new museum will showcase the past in a building fit for the future and give young and old a chance to access first-class cultural facilities and learn more about the important part Dunfermline has played in Scottish history."