first, under the carpet should be a pad of some sort, or maybe not. Makes no difference.
You need a threshold carpet strip to apply to the cut carpet. Comes in brass and chrome and wood. Grips the carpet and then you tack it down. Works nicely.
Your paint choice and considerations are: it will carry track in material and water from the outside. Paint will make this an ice rink if not careful. I would get a good quality oil base paint and apply this over a good primer which is applied over a well sanded and cleaned flooring.