A computational method for the inverse design of a directional solidification process of a near-eutectic binary alloy driven by the coupled action of buoyancy, thermocapillary, and electromagnetic convection is presented. The objective is to calculate the mold cooling/heating conditions such that a stable desired interface growth with growth velocity vf and thermal gradient G is achieved. The interface velocity vf and thermal gradient G are chosen such that a diffusion-based growth is obtained in the presence of melt convection. Morphological stability is enforced by imposing an appropriate magnitude of G/|vf|, which is determined a-priori based on the constitutional stability criterion. The design problem is posed as a functional optimization problem. The cost functional is defined so as to represent the deviation of the freezing interface thermal conditions from thermodynamic equilibrium. An appropriate continuum adjoint problem is defined such that an analytical expression for the gradient of the objective function is obtained. The conjugate gradient method coupled with the finite element solutions of the continuum direct, sensitivity, and adjoint problems is employed for solving the inverse problem. The method is demonstrated with an example of calculating the boundary thermal fluxes for the directional growth of an Sb-8.6% Ge melt in an open-boat configuration under the influence of an external horizontal magnetic field such that a stable vertical interface advances from left to right with a desired growth velocity.