A modification of the answer I linked to directly answer the question:
let rec insert v i l = //v - value to substitute, i - index at which to substitute, l - the list
match i, l with
| 0, x::xs -> v::xs //this line does the actual replace
| i, x::xs -> x::insert v (i - 1) xs //simply iterates one further through the list
| i, [] -> failwith "index out of range" // the given index is outside the bounds of the list
Note that this is not tail recursive and will Stackoverflow for large lists. Arrays or List would probably be a better choice if you need to do this type of operation.