It is not advisable to keep a male and female betta together in a one-gallon tank. While it may be possible for them to coexist peacefully for a short period of time, it is likely that the male will eventually become aggressive towards the female. Male bettas are territorial fish, and they will defend their territory against any perceived threats, including other bettas. In a small tank, there is not enough space for the female to escape the male's aggression, and she may be injured or even killed.
If you are interested in keeping bettas, it is best to keep them in separate tanks. A one-gallon tank is too small for any betta, regardless of its gender. Male bettas should be kept in tanks that are at least 2.5 gallons in size, while female bettas should be kept in tanks that are at least 5 gallons in size. This will give them enough space to swim and explore, and it will help to reduce the risk of aggression.