One way is to use RegExMatch:
if trim(RegExMatch(trim(concat(" ", @variable)), '([0-9]+)', 1)) != "" then
/* your code */
endif
The regular expression "([0-9]+)" matches all numeric characters, requiring at least one. Using the brackets and the third parameter "1" makes sure the number is returned.
The trim(concat(" ", @variable)) nesting makes sure you get a string to perform the RegEx on, even if your variable is null (unset). Trimming what comes back from RegExMatch is to make sure that no trailing spaces added by AMPscript methods gonna cause us headache (which I had experienced in the past).
If there is no match on your variable, the test will fail because you will get an empty string. If there is at least one numeric digit, the test will succeed, because it retrns a non empty string.
To convert the string to a numeric variable, you can use
Add(0,RegExMatch(trim(concat("0", @variable)), '([0-9]+)', 1))
By performing a mathematical operation on string variable that contains only numeric digits (add it to 0), the returned variable must be numeric.
But be careful, this works on plain integers. If the number in @variable can be decimal/floating (like 1.5) point or otherwise formatted (like 1'000), you need to make sure to replace those characters or add them to the RegEx. Use Format/NumberFormat for that purpose.