This paper presents the design and testing through simulation of a Fuzzy Logic Energy Management System (FLEMS) for an autonomous polygeneration microgrid. In this microgrid the energy is produced by photovoltaics and a wind turbine and the rest of the components include a battery bank, a Proton Exhange Membrane (PEM) fuel cell, a PEM electrolyzer, a metal hydride tank and a reverse osmosis desalination unit using energy recovery. The microgrid covers the electricity, transport and water needs and thus its products are power, hydrogen as transportation fuel and potable water through desalination. Initially an ON/OFF approach to the management and control of the devices was adopted. In this paper a new approach based on fuzzy logic was designed and tested through simulation. The devices being managed are the fuel cell, desalination unit and electrolyzer unit. A design tool based on TRNSYS 16, Matlab, GenOpt 2.0 and TRNOPT was developed using Particle Swarm Optimization (PSO) method. Two microgrids were sized using this tool in order to compare the performance of FLEMS with the ON/OFF approach. The results show that FLEMS utilizes the available energy in the system better and the components’ sizes are, thus, considerably decreased.