You can apply for a re-entry permit at the "re-entry visa" counter on the day you leave, after check-in and going through the security check. The counter is open
****
.
The easiest is going to the International Departure Gate 2. There is a counter on your right when you go down the escalator after the security check. If you go through another departure gate, you tell the officer at passport control you need a re-entry permit, then go all the way to the re-entry permit counter at Gate 2 from the airside.
You may want to add 15-20 minutes to get one. Sometimes several people are waiting. When no one is waiting, it may take a few minutes, but it may still take about 10 minutes.
The official fee is the same, 1000 baht for a single re-entry permit, 3800 baht for a multiple re-entry permit.
If you don't have a photo (passport size), you may be required to pay an extra service fee of 200 baht.