The Rum Diary is based on a true story, but it has its own interpretations. The film adaptation especially had to condense a lot of Thompson's experiences. It gets the general feel of the place, the political and social unrest, and the wild journalistic lifestyle right. But details like specific conversations or some minor plot points might be fictionalized to fit the story's flow and to make it more appealing to the audience.
Yes, it is fairly accurate. The Rum Diary is based on Hunter S. Thompson's own experiences, and while some fictional elements might be added for the sake of the story, it does capture the essence of the time and the events he went through in Puerto Rico.