That sounds like a tough test!
How fast / far can you swim now?
Typically you will need to cycle between sprints and endurance routines to build up.
100 meter sprints are really good for building a combo of speed and some endurance.
Then I would work on doing 500 meter swims. 3 x 500 will be your 1500 meter total, so if you can hold up well on a 500, that will get you going in the right direction.
Where will the test be? Pool or open water? What size pool? 25 meter, 50 meter, or yards? All have their peculiar quirks.
Stroke technique will also be important. If you search on the internet, you can find lots of routines to try. Swimming magazines always have stuff too if you can find them.