A dehumidifier will always be better for reducing humidity and making a room more comfortable in the heat than opening a window. An open window is more likely to reintroduce humid air into the room, making you feel hotter and stickier, while a dehumidifier will reduce this, making the space more comfortable even if it does not actually cool the space.