Short answer: No.
SMTLib (the language z3 and many other SMT solvers accept) is a many-sorted first-order logic. This means every variable has to have a known type during its declaration. The type can be one of the base types supported by the language (Int, Real, Bool etc.), or it can be a user-defined type, via the declare-datatype or declare-sort constructs.
See the language definition for details: http://smtlib.cs.uiowa.edu/papers/smt-lib-reference-v2.6-r2017-07-18.pdf
If you're trying to model a "dynamically" typed language (like Lisp, Python, etc.), then the usual trick is to declare a union of types that the variable can belong to, and switch accordingly as you interpret that language. But doing so directly in SMTLib can be rather verbose and error-prone, you're better of using a high-level interface like z3py or any of the high-level language bindings to z3, from Java, C, Haskell, Scala, etc. But in any of these encodings, it'll be up to you to make sure the types are properly stored and changed, the underlying language of SMTLib will remain strongly typed as described in the standard I linked above.