Preheat your air fryer to 400°F (200°C) for about 3 minutes.
Husk the corn, removing all the silk and any damaged outer leaves. Rinse the corn under cold water.
In a small bowl, combine olive oil, salt, and black pepper. Mix well.
Brush the olive oil mixture evenly onto each ear of corn using a basting brush, ensuring all sides are coated.
Place the corn on the cob in the air fryer basket, making sure they are not overcrowded. Cook in batches if necessary.
Cook the corn for 12 minutes, turning them halfway through the cooking time for even roasting.
After cooking, carefully remove the corn from the air fryer using tongs. Let them cool slightly before serving.
Add optional toppings, such as butter, grated cheese, paprika, or fresh herbs, if desired, before serving.