Den, Let me see if I can explain this "properly". It would be so much easier if I could draw a picture.
Like the previous comment, buy some edging or binding. This is a fabric that is approx 3/4 " wide and comes in rolls and in a variety of collors. From the TOP of the carpet, sew the biinding on. Here is where is is tricky to explain.
top binding =============== carpet
Sew it right over there along the edge. Then turn the carpet upside down and use contact cement. You put some on the edge of the binding that you are going to fold over and some on the jute backing of the carpet. Once both have dried completely, then MASH them together. That is why they call it contact bond is that is adheres on contact.
Note: carpet is laying upside down
========================== Top or nap of carpet / fold this back and glue.