AllowedChildTypes
is a field of the workspace content, so you can set its value like other field values. The value should be an array of strings (array of content type names).
content["AllowedChildTypes"] = ["File"];
await content.SaveAsync();
There's also an OData action for adding a content type to a content's AllowedChildTypes, its name is AddAllowedChildTypes
and it should get a contentType array (string array of content type names) as parameter.
dynamic workspace = await Content.LoadAsync(workspace);
Task<dynamic> task = workspace.AddAllowedChildTypes(new {contentTypes = ["File"]});
var result = await task;
https://community.sensenet.com/docs/built-in-odata-actions-and-functions/#add-types-to-allowed-child-types-action