Thanks for your suggestions, @valhalla. With the map operation the dataset loading looks much more concise now. However, I am still getting that IndexError: Target 2 is out of bounds. error when I call trainer.train(). This is the complete code I have right now:
# [...]
dataset = nlp.load_dataset(
    "csv",
    delimiter="\t",
    data_files={"train": "spanish_train.csv", "validation": "spanish_val.csv"},
)

label_to_int = {
    "AGAINST": 0,
    "FAVOR": 1,
    "NEUTRAL": 2
}
dataset = dataset.map(lambda example: {"LABEL": label_to_int[example["LABEL"]]})
# [...]
trainer.train()

Maybe the model.config.num_labels = 3 statement is not being interpreted by the model?
EDIT: By checking whats in model.config, I got the following:
BertConfig {
  "architectures": [
    "BertForMaskedLM"
  ],
  "attention_probs_dropout_prob": 0.1,
  "gradient_checkpointing": false,
  "hidden_act": "gelu",
  "hidden_dropout_prob": 0.1,
  "hidden_size": 768,
  "id2label": {
    "0": "LABEL_0",
    "1": "LABEL_1",
    "2": "LABEL_2"
  },
  "initializer_range": 0.02,
  "intermediate_size": 3072,
  "label2id": {
    "LABEL_0": 0,
    "LABEL_1": 1,
    "LABEL_2": 2
  },
  "layer_norm_eps": 1e-12,
  "max_position_embeddings": 512,
  "model_type": "bert",
  "num_attention_heads": 12,
  "num_hidden_layers": 12,
  "output_past": true,
  "pad_token_id": 1,
  "type_vocab_size": 2,
  "vocab_size": 31002
}

I am seeing that the labels in id2label and label2id are generic. Might this be a problem?