How to prevent Android from creating Android and Lost.dir folders on external otg storage? If I either connect my Camera using a USB cable via OTG or inserting the SD card in a OTG reader connected to the phone Android creates automatically two folders: an Android folder an a Lost.Dir folder. 

The problem is that as long as these two folders are on the camera (a Pentax K50), this latter thinks that the SD is not properly formatted and asks me if I want to format it or otherwise I cannot use it again. And indeed if I delete the two folders using my PC I can then start using the card again. Obviously I cannot format it.

The problem is that I cannot delete these folders on the phone without reliably preventing android from recreating them. Also the two folders remain on the SD even if I properly eject the OTG storage.

The problem is that I am going on a trip and I won't be having a pc with me. How can I then transfer the photos from my camera to the smartphone?
Android folder is used to keep data about your apps. Deleting it from the internal storage or external storage (when used as adoptable storage) will cause the loss your apps' data. 

LOST.DIR is a folder used to place recovered files during boot. It is usually empty. Deleting this folder is safe.

In your case, you can delete both folders without creating any issue. Delete the folders, then disconnect the SD card as mentioned by @Chrisii. It is a process that you will have to accomplish every time because the folders will be re-created by the Android OS when the SD card is connected.

All you need to know about LOST.DIR folder on Android devices

What is the use of an Android folder? What happens if I delete this folder?