This phase Ib trial studies the side effects and best dose of entinostat when given together with pembrolizumab in treating patients with myelodysplastic syndrome after deoxyribonucleic acid (DNA) methyltransferase inhibitor (DNMTi) therapy failure. Entinostat may stop the growth of cancer cells by blocking some of the enzymes needed for cell growth. Monoclonal antibodies, such as pembrolizumab, may interfere with the ability of cancer cells to grow and spread. Giving entinostat together with pembrolizumab may work better in treating patients with myelodysplastic syndrome after DNMTi therapy failure.