Dimension D is first encountered in Level 3-3 within The Bitlands. It is meant to make Dimentio 256 times stronger than normal, allowing him to beat Mario and his allies. Unfortunately for Dimentio, Mario and his friends also become stronger in this dimension, effectively negating the effects of Dimentio's trap.
Dimentio is fought here yet again later in the game in Castle Bleck. Afterward, during the final battle, Dimentio traps Count Bleck, Tippi, and others within Dimension D. The Pure Hearts are used by Count Bleck to break the dimension and travel back to Castle Bleck at the end of the battle.