Thank you @Vitaliy Kurokhtin for the comment.
The reason you're facing the issue is due to wrong syntax, APIM requires expressions to be enclosed in @(...), not "@{...}".
Wrapping the code inside @(...) ensures it is evaluated before being assigned.
Use DateTime.UtcNow Instead of DateTime.Now , this will avoid time zone inconsistencies.
Since APIM policies are written in XML, double quotes (") inside the `value` attribute must be escaped as `"`.
Replace your existing policy with the following,
<inbound>
<base />
<set-query-parameter name="timestamp"
value="@(Uri.EscapeDataString(DateTime.UtcNow.ToString("yyyyMMddHHmmssfff") + "+0000000"))" />
</inbound>
Please refer MsDoc1, MsDoc2 for better understanding of APIM policy expression, Set query string parameter respectively.