The present paper is concerned with investigating the capability of the smoothness preserving fictitious domain method from Mommer (IMA J. Numer. Anal. 26:503–524, 2006) to shape optimization problems. We consider the problem of maximizing the Dirichlet energy functional in the class of all simply connected domains with fixed volume, where the state equation involves an elliptic second order differential operator with non-constant coefficients. Numerical experiments in two dimensions validate that we arrive at a fast and robust algorithm for the solution of the considered class of problems. The proposed method can be applied to three dimensional shape optimization problems.