So if these values are numeric this should work
from traces-apm-default
| where http.response.status_code is not null
| eval success = case(http.response.status_code >= 200 and http.response.status_code < 400, 1,0)
| keep @timestamp, http.response.status_code, success
If they are keyword you will need to convert to integer something like this
from traces-apm-default
| where labels.http_status_code is not null
| eval status_num = to_integer(labels.http_status_code)
| eval success = case(status_num >= 200 and status_num <= 400, 1,0)
| keep @timestamp, labels.http_status_code, success