Off-grid microgrids constitute an increasingly viable alternative to grid extension for rural electrification. Thanks to significant reductions in hardware cost, energy cost for off-grid users in areas sparsely covered by the national grid has become competitive with grid-connection once infrastructural costs are accounted for. Microgrids offer advantages also from an environmental and social point of view, featuring generation systems with high renewable penetration and facilitating the involvement of local communities in development projects. To further enhance microgrids economic competitiveness, it is necessary to devise innovative control strategies and design algorithms, that can ensure an optimal operating performance at the lowest overall cost. In this paper we present a new predictive design and dispatch optimization algorithm based on Mixed Integer Linear Programming (MILP). The new method is compared to a previously developed heuristic methodology, applying both to the design and yearly performance estimation of local microgrids, characterized on the basis of real data relative to a sub-Saharan African region. The potential advantages of including the proposed microgrid design method in a regional electrification planning model are illustrated in a realistic case example.